refactoring for the final document