cleaning up the group up function