removed global variable app, added a few new things