Updated get_ranges with more appropriate var names
Updated get_ranges to use lists rather than sets