added logic to update file