refactor document structure.