modified search method logic