Added invert function.