refactored app.rb into model.rb