refactor and rspec