Changed core_numbers to use d_ary_heap and only update queue elements that are in the queue; fixes #7341