Refactor command dispatching to be more git style