converted for ARC and iOS 6.0+