minor changes

Recursive to iterative conversion