modify tco (tail call optimization)