Move this retry logic into out of this function.