Adding retry flags
Adding retry logic