okay this works but is still highly dependent on the search window. Going to try some multiprocessing