refactore dispatcher