added output for gnuplot, refactored