clean up of code & save values of fields to database file using csv style formatting