added most functionality for the graph