functional XOR method