added ReplicaExchange class, cleanup