simplify the _toggleInvert function