function WORincreaseBodyBloodinessByClothingBloodiness(player, wornItems, visual, bodyPartCount)
    --print("Logger: running WORincreaseBodyBloodinessByClothingBloodiness function");

    -- Bloodiness Sandbox
    local minimumClothingBloodinessRequired = SandboxVars.WashOrRot.MinimumClothingBloodinessRequired
    --print("minimumClothingBloodinessRequired: " .. minimumClothingBloodinessRequired)
    local percentage = SandboxVars.WashOrRot.ClothingBloodinessPercentageToTransfer / 100
    --print("percentage: " .. percentage)

    -- Calculate the total bloodiness from all worn clothing
    local totalClothingBloodiness = 0

    for i = 0, wornItems:size() - 1 do
        local item = wornItems:get(i):getItem()
        if item:IsClothing() then
            local itemBloodiness = item:getBloodlevel()
            --print("itemBloodiness: " .. itemBloodiness)
            --print("The Item " .. item:getName() .. " has " .. item:getBloodlevel() .. " of bloodLevel")
            if itemBloodiness > minimumClothingBloodinessRequired then
                totalClothingBloodiness = totalClothingBloodiness + itemBloodiness / 100

                -- Decrease the bloodiness of the item by the percentage used for transfer
                local percentageAux = 1 - percentage
                item:setBloodLevel(itemBloodiness * percentageAux)
                if item:getBloodlevel() < minimumClothingBloodinessRequired then
                    item:setBloodLevel(minimumClothingBloodinessRequired)
                end
            end
        end
    end

    local bloodinessPerBodyPart = (totalClothingBloodiness * percentage) / bodyPartCount
    --print("bloodinessPerBodyPart: " .. bloodinessPerBodyPart)
    local overallBodyBloodiness = 0

    -- Apply the bloodiness to each body part
    for i = 0, bodyPartCount - 1 do
        local bloodBodyPartType = BloodBodyPartType.FromIndex(i)
        local currentBloodiness = visual:getBlood(bloodBodyPartType)
        local newBloodiness = math.min(currentBloodiness + bloodinessPerBodyPart, 1)
        visual:setBlood(bloodBodyPartType, newBloodiness)
        --print("The Body Part " .. BloodBodyPartType.getDisplayName(bloodBodyPartType) .. " has " .. visual:getBlood(bloodBodyPartType) .. " of bloodiness")
        overallBodyBloodiness = overallBodyBloodiness + newBloodiness
        --print("overallBodyBloodiness: " .. overallBodyBloodiness)
    end

    return overallBodyBloodiness
end

function WORhandleBloodinessTimeUntilEffects(player, bodyOverallBodyBloodiness, bloodinessIncreaseDecreaseRateUntilEffects)
    --print("player:getModData().WORbodyBloodiness: " .. player:getModData().WORbodyBloodiness)

    -- Over 75% of body bloodiness will start to increase slighly faster the counter for the effects
    if bodyOverallBodyBloodiness > 13.5 then 
        player:getModData().WORbodyBloodiness = player:getModData().WORbodyBloodiness + (0.3 * bloodinessIncreaseDecreaseRateUntilEffects)
    -- Over 50% of body bloodiness will start to increase the counter for the effects
    elseif bodyOverallBodyBloodiness > 9 then
        player:getModData().WORbodyBloodiness = player:getModData().WORbodyBloodiness + (0.2 * bloodinessIncreaseDecreaseRateUntilEffects)
    elseif bodyOverallBodyBloodiness > 3 and bodyOverallBodyBloodiness < 9 then
    -- Under 50% of body bloodiness will start to decrease the counter for the effects
        player:getModData().WORbodyBloodiness = player:getModData().WORbodyBloodiness - (0.2 * bloodinessIncreaseDecreaseRateUntilEffects)
    else
        player:getModData().WORbodyBloodiness = 0
    end
    -- Keep the counter between 0 and 100
    if player:getModData().WORbodyBloodiness > 100 then
        player:getModData().WORbodyBloodiness = 100
    elseif player:getModData().WORbodyBloodiness < 0 then
        player:getModData().WORbodyBloodiness = 0
    end

    --print("player:getModData().WORbodyBloodiness: " .. player:getModData().WORbodyBloodiness)
end