refactored for iOS7 SDK