Ported HSMG to module.  Removed equivalence of mask and imask