Added calculation of x1, x2, y, tau, theta, phi and s_hat