Remove tail recursive call in table export code