changed each to while.