Set first match and rework do_search logic
Rework on do_search logic