some refactorings
some corrections for specs