Outsourced graph making function. Added graph export.