some refactoring + spec