Cleanup hooks file

Got rid of repeated code for calling normal hooks, added the missing
"Halt" mode to global hooks and bounded some local values.