Updated MAD to hopefully work correctly.