some refactorings and more specs