Merge pull request #2898 from Guflly/refactor/calm-document-types