Document refactoring