dispatcher: reorganize the code by using a define