added geolocation function, minor bugfixes