distance and gps now work, huge restructuring of code