refactoring for geolocation functions.
initial error handling for geolocation.