Updated internal logic in SearchEngine