refactoring + test