Command processing refactoring.