adding marjor fixes to groups and other refactoring