add function to merge divided groups