moved hooks into init

I'm afraid this is untested as I'm having some trouble setting up the test suite (something MySQL-related)