Changed the way the code produces graphs.