Replication cleanup and improvements