Added decoding of GPS data and some minor reorganization