Changed outdated code to modern objective-c syntax