added back the rangepos argument