refactoring + simple test