This is due to the implementation being recursive. So can just refactor to use a trampoline or other iterative approach.