lots of refactoring, all specs passing