How does replication work?