refactored code
seventh test failed - undefined method