refactoring, more tests