working on replication logic