Refactoring + test