Updated code for iOS 8 Notifications compatibility