Application errors are now caught and handled
Moved database comitting to app.teardown_request