lots of debug code still in place, but get a much improved structure for MIDI automat...