more specs and refactoring