refactor app.rb