Changed loop from "for" to "do-while". Added decrement at end of do loop to decrease size of array tested after each iteration.