Refactor around hook execution.