Modified search loop to use pipelining for better performance