Adding location logic