Refactoring, new tests