Extract various helper methods, and push down sorting into ReplicasetMember