mostly done with write file