Reformat the output document