Wrote iterator. Rewrite it to use a stack.