cleaned up code, new rspec cases