Completed the db replication script