Refactoring of search module