New midi functions and O3 optimize