Broken stuff.
Added a lot of debug output. Probably all bugs fixed, needs testing.
Merge branch 'keyEvent' of github.com:fhinkel/tryM2 into keyEvent