Fixed misspelled word.
Refactored to use recursion.
Merge pull request #1 from briankereszturi/master

Allow deep group recursion, but avoid infinite loops (thanks briankereszturi)