Updated code to fix unsafe delegate call. Replaced unsafe_retained to use ARC's weak attribute