Refactor some search stuff

this is too beautiful. the dudes who came up with this are so smart. :+1: