refactor specs and factories