added option to write CSV files to output directory
added proper output directory and prefix handling for graphs and csv files
added underscore to prefix