Factor out search code to own class SearchEngine. [issue #4]