Fix/15403/debug in group and add unittests

Updated unittests -they actually work now- and did some minor code changes to accomodate that