refactoring and documenting