updated search location logic