implemets write csv
update sample programs