saving of graphs is working now. still needs some tweaking