Refactoring of MasterImpl and BackupImpl to have SPI, so that they are testable