some refactoring and one test