Generalize group detection