Created functions for the graph to work properly i think