Added support for optgroups