Refactor failover