Updated replication logic