some refactoring, tests