Improved timeout handling and retries.