Format the document and add fixes