continuing refactor of the graph building code