Cleaned the code up a little bit. Fixed a bug on quitting the app.