specs and refactor