Adding XOR handling, still non-functional