refactoring + documentation