Rework some plugin MIDI code, closes #134