revamped RangeExtractor to a better API