refactor, split Document module