Refactor check_hooks method in dispatcher.