Minor refactoring of IsInGroup so it can take arrays and dicts