changed rangeList to generator