eCashflow(monthExpenses);
                createPieChart(categoryData);
                updateLegend(categoryData);
            }
        }

        function updateCashflow(expenses) {
            const income = calculateIncome(expenses);
            const expenseTotal = calculateExpenses(expenses);
            const balance = income - expenseTotal;
            
            document.getElementById('cashflow-income').textContent = formatCurrency(income);
            document.getElementById('cashflow-expenses