moved graph to class
code cleanup