Add retry mechanism instead of sleep