Various changes and a great hook debug script. Disabled by default.