Adding invert function