Refactored app.rb