add routines to read from and write into a file. incomplete