finist part of part 3
has a bug in write, nothing has been writing to the file