[#509] Fix bug in add/remove groups
[#509] Test fixups
[#509] minor indentation cleanup
Merge branch '509-group-add-remove'