final solution by JQuigs and cjcjameson for GPS 2.1