added retries and sleeps