Added code for replicas.