Added in capability to write to the file on refresh