Improving retry mechanism: resetting count to zero after success