updated for iOS7 compatibility