small refactoring, new tests