better pattern matching for team membership