updated code to ARC and modern Objective C