Updated for compatibility with Swift (Xcode Beta 3)