Wrote a couple of specs and refactored some code