attempt to cleanup midi-writing a little bit.