[#509] Fix bug in add/remove groups
[#509] Test fixups
[#509] minor indentation cleanup