Tidy some tests and move hooks to HookRegistry