All my code above example does is build an array of groups that the users is a member of. Having this data in an array makes it easy to walk through the information in less amount of code.

I guess I am still a little bit confused on what you are wanting to do.

Are you wanting to do only X action if a user is in Y set of groups?

code:
if ingroup("things") and ingroup("stuff")
;only do something if this user is in both of the things and stuff groups.
endif

or

code:
if ingroup("things") <> 1 and ingroup("stuff") <> 1
;only do something if this user is not in both of the things and stuff groups.
endif

Bryce