Fix and refactor specs