updated for Swift1.1