some modest performance improvements to the graph stuff