added location logic