Use a stack for hooks.