repeats '2', maybe iterator needs to be outside while loop