refactor search engine class