Refactor product search