Some tidying up of graph code.