Use for() iteration rather than doing array shifting.