Large refactor, esp. of command replication