clean up search loop