added code to output figures and created figure png files