move gps function to main app