Fix up the keyboard/mouse hooks, misc debugging changes.