modified extractGPS-function