Moved code to app.rb