updated for Swift 1.1