function _allocateAssets(uint256 amount) internal returns (uint256 totalDeployed) {
    totalDeployed = 0;
    for (uint256 i = 0; i < _strategies.length; ) {
@>      uint256 fractAmount = (amount * _weights[i]) / _totalWeight;
        if (fractAmount > 0) {
@>          totalDeployed += IStrategy(_strategies[i]).deploy(fractAmount);
        }
        unchecked {
            i++;
        }
    }
}

function _deallocateAssets(uint256 amount) internal returns (uint256 totalUndeployed) {
    uint256[] memory currentAssets = new uint256[](_strategies.length);

    uint256 totalAssets = 0;
    uint256 strategiesLength = _strategies.length;

    for (uint256 i = 0; i < strategiesLength; i++) {
@>      currentAssets[i] = IStrategy(_strategies[i]).totalAssets();
        totalAssets += currentAssets[i];
    }
    totalUndeployed = 0;
    for (uint256 i = 0; i < strategiesLength; i++) {
@>      uint256 fractAmount = (amount * currentAssets[i]) / totalAssets;
@>      totalUndeployed += IStrategy(_strategies[i]).undeploy(fractAmount);
    }
}

function _rebalanceStrategies(uint256[] memory indexes, int256[] memory deltas) internal {
    ...
    // Iterate through each strategy to adjust allocations
    for (uint256 i = 0; i < totalStrategies; i++) {
        // if the delta is 0, we don't need to rebalance the strategy
        if (deltas[i] == 0) continue;

        // if the delta is positive, we need to deploy the strategy
        if (deltas[i] > 0) {
            uint256 balanceOf = IERC20(_strategies[indexes[i]].asset()).balanceOf(address(this));
            uint256 amount = uint256(deltas[i]) > balanceOf ? balanceOf : uint256(deltas[i]);
            IStrategy(_strategies[indexes[i]]).deploy(amount);
            // if the delta is negative, we need to undeploy the strategy
        } else if (deltas[i] < 0) {
@>          IStrategy(_strategies[indexes[i]]).undeploy(uint256(-deltas[i]));
        }
    }
    ...
}

function removeStrategy(uint256 index) external onlyRole(VAULT_MANAGER_ROLE) {
    ...
    // If the strategy has assets, undeploy them and allocate accordingly
@>  if (strategyAssets > 0) {
@>      IStrategy(_strategies[index]).undeploy(strategyAssets);
        _allocateAssets(strategyAssets);
    }
    ...
}
