Refactor application of hook.