Modified for iOS7/Xcode5