initial version of graphs working