simplify optgroup generation