refactor document class