Working graph
Cleaned up the code