writing working with replication