Use each instead of while.