added option to enable/disable the sorting of groups