Tidy up renumber code