Changed variables for heading calculation