More efficient (but not yet correct) MDM calculation