Refactoring + tests continued