added graceful retry mechanism