added early termination to the algorithm when the found index is >= 1024. This stops it from oscillating and will give us good accuracy