adding timeout handling and optional failover