```\nif (collateralval > amountToBuyLeftUSD) {\n   // sell a portion of collateral and exit\n   if (collateral[i].pathsell.length > 0) {\n       uint256 amountBefore = IERC20Upgradeable(baseAsset).balanceOf(USSD);\n       uint256 amountToSellUnits = IERC20Upgradeable(collateral[i].token).balanceOf(USSD) * ((amountToBuyLeftUSD * 1e18 / collateralval) / 1e18) / 1e18;\n       IUSSD(USSD).UniV3SwapInput(collateral[i].pathsell, amountToSellUnits);\n       amountToBuyLeftUSD -= (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n       DAItosell += (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n   } \n   else {\n       // no need to swap DAI\n       DAItosell = IERC20Upgradeable(collateral[i].token).balanceOf(USSD) * amountToBuyLeftUSD / collateralval;\n   }\n}\n\nelse {\n   // @audit-issue Not handling the case where this is DAI as is done above.\n   // sell all or skip (if collateral is too little, 5% treshold)\n   if (collateralval >= amountToBuyLeftUSD / 20) {\n      uint256 amountBefore = IERC20Upgradeable(baseAsset).balanceOf(USSD);\n      // sell all collateral and move to next one\n      IUSSD(USSD).UniV3SwapInput(collateral[i].pathsell, IERC20Upgradeable(collateral[i].token).balanceOf(USSD));\n      amountToBuyLeftUSD -= (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n      DAItosell += (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n   }\n}\n```\n