Working multiple replicas code
Modified