refactored to make more sense
return app object