implement multiple replicas (haven't tested for more than one)

Signed-off-by: James Paton <jpaton2@gmail.com>