Minor bug fix.
Added logging routine.
Removed unnecessary prepare.
Minor replication bugs.