refactored to use nsurlsession instead of asihttprequest