GPS merge

Base code synchronised between the two versions