handling the outputted documents