Updates for iOS 7 and refactoring