modified search logic