Refactor cluster replication