more thorough approach to adding groups, still some bugs