changed invert so it doesn't use the boolean 'invert' any more. Logic is much simplier. I believe I actually have fixed the inversion bugs. Tested it a bit as well.