Refactored hook execution