Added XOR encoding