changed search logic