Improve iterators in for loops

For the three for loops that modify the lists being iterated over, I have added a list() wrapper around the list so that the for loops iterate over a copy of the list while the list is being modified.  Also replaced index in loop with a reference to the iterator.

Thanks,

Mark