Fix up renumbering, and make graph-making better