refactor document