Cleaned up AppDelegate code