Fix search logic; was getting duplicates
clean up search logic