adding the functionality to write a partial file