Implemented saving of graphs.