Optimize search method