Refactor some search stuff

nice