Refactor some search stuff

does this actually work?