trim_groups() exported