some changes to weighted range generation