Improve the retry mechanism