Added real geolocation code
Minor tweaks from testing.