Remove needless code and refactor specs