modified to work with AFNetworking