Added the invert function