add rangeVal function