implement subgroups for ms and msms