added useful changes from callibrate_ppp, but none of the not yet right callibration stuff