now managing properly number of retries (set to 3 for now) avoiding endless loops when exceptions occur.