refactored long methods
fixed refactoring issue, rspec tests pass