improve SetRates function