Refactor some search stuff

:smirk: