Modified updateRowNumbers to use for loop
Forgot to relete initial declaration of iterator in updateRowNumbers