Add replicaset support

ReplicaSet support based on smacintyre code