added 3-axis calculation code