Tidied GPS code