added support for replication