modularize the retryies