Changed code for user location detection.