added support to return a list of group memberships

refactored, i rely on intelliJ formatting, unless you mean the extra new line?