code refactoring and bug fixes in new hybrid search algorithm