Slight optimization to Midi.