Updated for Swift.