Slightly nicer debugging
Only print debug information if debugging is actually occurring
If a keydown gets aborted, abort the keyup event as well so the global state is consistent with the internal state.
Additionally, treat the keydown like a transaction; if it's aborted, revert to the previous state.
This resolves #1