Credits to Nathan Oates http://noates.com/pebbGPS.html