refactor TaskDispatcher a bit to please RuboCop