Rewrite the documents