Refactor some search stuff

Turns out this was completely broken. :arrow_up:. Who knew?