Moved all `register` API calls out of init.lua and into hooks.lua so
they could be more easily tested.