some refactoring, more tests