Added timeouts and retry logic to download functionality