Refactoring in geolocation example