Added a flag to delete the original file