Added some code for graph generation.