some changes to file write and iteration 1

iteration 1 added; more changes to come