How replication works?