Move hooks to a dedicated module.
This allows for greater flexibility and easier editing.
TODO: Make hook handling neater (possibly through parsing the hook
script to read an "hook-to" marker that allows for automated
loading of properly formatted hook functions)