moved graph creation