Refactor retries