Use x = !x, inversion to simplify code.