```\nfunction swapAndSendDividends(uint256 tokens) private {\n    if (tokens == 0) {\n        return;\n    }\n    swapTokensForEth(tokens);\n    uint256 totalAmount = buyAmount.add(sellAmount);\n\n    bool success = true;\n    bool successOp1 = true;\n\n    uint256 dividends;\n    uint256 dividendsFromBuy;\n    uint256 dividendsFromSell;\n\n    if (buyRewardsFee > 0) {\n        dividendsFromBuy = address(this).balance.mul(buyAmount).div(totalAmount)\n        .mul(buyRewardsFee).div(buyRewardsFee + buyMarketingFees);\n    }\n    if (sellRewardsFee > 0) {\n        dividendsFromSell = address(this).balance.mul(sellAmount).div(totalAmount)\n        .mul(sellRewardsFee).div(sellRewardsFee + sellMarketingFees);\n    }\n    dividends = dividendsFromBuy.add(dividendsFromSell);\n\n    if (dividends > 0) {\n        (success, ) = address(dividendTracker).call{value: dividends}("");\n    }\n    \n    uint256 _completeFees = sellMarketingFees + buyMarketingFees;\n\n    uint256 feePortions;\n    if (_completeFees > 0) {\n        feePortions = address(this).balance.div(_completeFees);\n    }\n    uint256 marketingPayout = buyMarketingFees.add(sellMarketingFees).mul(feePortions);\n\n    if (marketingPayout > 0) {\n        (successOp1, ) = address(marketingWallet).call{value: marketingPayout}("");\n    }\n\n    emit SendDividends(dividends, marketingPayout, success && successOp1);\n}\n```\n