Adding support for optgroups