working xor function