Reorder conditions according to their frequency

This should minimize useless tests.

No functional change.
Simplify search results update

Also some rename while there.

No functional change.
Fix a stale comment

No functional change.