More linear recursion to iterative stack stuff