Updated the code to work on Xcode 6 - Beta 6