Refactor app.rb move code into external class