Improve group function.