Refactoring command dispatching - work in progress