added file writer for csv output