Refactored CommandDispatcher to enable reuse