UPDATED to work with SDK 6.0 and new XCode