Added retry mechanism.