Added code to compute x inverse.