updated printGroups to not fail when no groups

Also documented the function