implemented more comprehensive DOM transversal solution with group option