move getExchangeRate to a separete function