refactoring and tests
Updated Gemfile for Heroku