Adding set_replication function