Fix log output
Added XOR factor function.