Add mg support