```\n    function _cancelOrderAccounting(OrderRequest calldata orderRequest, bytes32 orderId, OrderState memory orderState)\n        internal\n        virtual\n        override\n    {\n        // rest of code\n\n        uint256 refund = orderState.remainingOrder + feeState.remainingPercentageFees;\n\n        // rest of code\n\n        if (refund + feeState.feesEarned == orderRequest.quantityIn) {\n            _closeOrder(orderId, orderRequest.paymentToken, 0);\n            // Refund full payment\n            refund = orderRequest.quantityIn;\n        } else {\n            // Otherwise close order and transfer fees\n            _closeOrder(orderId, orderRequest.paymentToken, feeState.feesEarned);\n        }\n\n\n        // Return escrow\n        IERC20(orderRequest.paymentToken).safeTransfer(orderRequest.recipient, refund);\n    }\n```\n