Retry download before giving up

Retry download before giving up (20 times)
Code cleaning