Move setRate to amountFromQuality free function