Reformat the document