Added Inversion code