ekristen replicaset code rewrite