added option to save graphs