Cleaning up network graph code