print groups in reverse to support nested functions again