changed the xor flags to flipped bit flags