Refactor `search` to be more readable per feedback