documenting and refactoring