Added support for multiple groups and nil option