updating code for swift 1.1