Added explanation of the xor logic.