Refactoring hook registration.

Now, we have a HookRegister object, and it knows how to do everything
with registering hooks. We just delegate key things to that, and done!