```\nfunction swapAndLiquify(uint256 tokens) private lockTheSwap {\n    // Split the contract balance into halves\n    uint256 denominator = (buyFee.liquidity +\n        sellFee.liquidity +\n        buyFee.marketing +\n        sellFee.marketing +\n        buyFee.dev +\n        sellFee.dev) * 2;\n    uint256 tokensToAddLiquidityWith = (tokens *\n        (buyFee.liquidity + sellFee.liquidity)) / denominator;\n    uint256 toSwap = tokens - tokensToAddLiquidityWith;\n\n    uint256 initialBalance = address(this).balance;\n\n    swapTokensForEth(toSwap);\n\n    uint256 deltaBalance = address(this).balance - initialBalance;\n    uint256 unitBalance = deltaBalance /\n        (denominator - (buyFee.liquidity + sellFee.liquidity));\n    uint256 bnbToAddLiquidityWith = unitBalance *\n        (buyFee.liquidity + sellFee.liquidity);\n\n    if (bnbToAddLiquidityWith > 0) {\n        // Add liquidity to pancake\n        addLiquidity(tokensToAddLiquidityWith, bnbToAddLiquidityWith);\n    }\n\n    // Send ETH to marketing\n    uint256 marketingAmt = unitBalance *\n        2 *\n        (buyFee.marketing + sellFee.marketing);\n    uint256 devAmt = unitBalance * 2 * (buyFee.dev + sellFee.dev) >\n        address(this).balance\n        ? address(this).balance\n        : unitBalance * 2 * (buyFee.dev + sellFee.dev);\n\n    if (marketingAmt > 0) {\n        payable(_marketingAddress).transfer(marketingAmt);\n    }\n\n    if (devAmt > 0) {\n        _devwallet.transfer(devAmt);\n    }\n}\n```\n