Refactored to be a category of UIApplication instead of UIApplicationDelegate