Added support for automatic failover