specs and small refactorings