Rewrote MI wrapper to use fixed memory, removed all dynamic allocation