update the document structure