Refactoring: introduced function evalSearch