Failover

Preliminary code.