moved output of processed file into save function