Refactored updateCurrencyRates() function