Small refactor of dispatcher