refactored locationManager method