Transitioned group identification to a recursive tail function.