Add timeout handling and error retry