Corrected spiral search algorithm.