Fixed a math error in calculating the angle value.