Added option to delete intermediate images