invert function added