finish file read and write
modify file read and write functions