added calculation of x