```\nfunction _collectFees(uint256 idle, uint256 debt, uint256 totalSupply) internal {\n    address sink = feeSink;\n    uint256 fees = 0;\n    uint256 shares = 0;\n    uint256 profit = 0;\n\n    // If there's no supply then there should be no assets and so nothing\n    // to actually take fees on\n    if (totalSupply == 0) {\n        return;\n    }\n\n    uint256 currentNavPerShare = ((idle + debt) * MAX_FEE_BPS) / totalSupply;\n    uint256 effectiveNavPerShareHighMark = navPerShareHighMark;\n\n    if (currentNavPerShare > effectiveNavPerShareHighMark) {\n        // Even if we aren't going to take the fee (haven't set a sink)\n        // We still want to calculate so we can emit for off-chain analysis\n        profit = (currentNavPerShare - effectiveNavPerShareHighMark) * totalSupply;\n        fees = profit.mulDiv(performanceFeeBps, (MAX_FEE_BPS ** 2), Math.Rounding.Up);\n        if (fees > 0 && sink != address(0)) {\n            // Calculated separate from other mints as normal share mint is round down\n            shares = _convertToShares(fees, Math.Rounding.Up);\n            _mint(sink, shares);\n            emit Deposit(address(this), sink, fees, shares);\n        }\n        // Set our new high water mark, the last nav/share height we took fees\n        navPerShareHighMark = currentNavPerShare;\n        navPerShareHighMarkTimestamp = block.timestamp;\n        emit NewNavHighWatermark(currentNavPerShare, block.timestamp);\n    }\n    emit FeeCollected(fees, sink, shares, profit, idle, debt);\n}\n```\n