Added support for variable numbers of replicas (non-const F and NReplicas)