Refactoring search module