midiogre: fix best match + code cleanup