Refactor command processing architecture.