Added function to edit an existing file