MDMC code superficially working