HID fix cleaned up

This pull request should have merged the fixes that Tim already had in place, and mine that came later, and have cleaned up the non-related commits.

If this one is fine, I can retract the other one.