refactored app.rb

Refactored a bunch of things in app.rb