Added replication check code, gems to get it to work