diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 8980ca1521ef0256940da1533a3897b568eae970..fec93c0782ca58961f7656570a0d126b2395a7dc 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.530 2006-08-18 02:22:40 geuzaine Exp $
+// $Id: GUI.cpp,v 1.531 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -190,13 +190,13 @@ Context_Item menu_geometry[] = {
     Context_Item menu_geometry_elementary[] = {
       {"0Geometry>Elementary", NULL} ,
       {"Add",       (Fl_Callback *)geometry_elementary_add_cb} ,
+      {"Delete",    (Fl_Callback *)geometry_elementary_delete_cb} ,
       {"Translate", (Fl_Callback *)geometry_elementary_translate_cb} ,
       {"Rotate",    (Fl_Callback *)geometry_elementary_rotate_cb} ,
       {"Scale",     (Fl_Callback *)geometry_elementary_scale_cb} ,
       {"Symmetry",  (Fl_Callback *)geometry_elementary_symmetry_cb} ,
       {"Extrude",   (Fl_Callback *)geometry_elementary_extrude_cb} ,
       {"Coherence", (Fl_Callback *)geometry_elementary_coherence_cb} ,
-      {"Delete",    (Fl_Callback *)geometry_elementary_delete_cb} ,
       {0} 
     };  
         Context_Item menu_geometry_elementary_add[] = {
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 7afdac7eb2386e4af7da8fc9e2d0c5fb6a545b1a..796a27cc0a0cd050bdfbe73528026c3190ef4c1d 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -1,4 +1,4 @@
-// $Id: GModel.cpp,v 1.12 2006-08-18 02:22:40 geuzaine Exp $
+// $Id: GModel.cpp,v 1.13 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -21,17 +21,22 @@
 
 #include "GModel.h"
 
-GModel::~GModel()
-{ 
+void GModel::destroy()
+{
   for(riter it = firstRegion(); it != lastRegion(); ++it)
     delete *it;
+  regions.clear();
   for(fiter it = firstFace(); it != lastFace(); ++it)
     delete *it;
+  faces.clear();
   for(eiter it = firstEdge(); it != lastEdge(); ++it)
     delete *it;
+  edges.clear();
   for(viter it = firstVertex(); it != lastVertex(); ++it)
     delete *it;
-  delete normals; 
+  vertices.clear();
+  if(normals) delete normals;
+  normals = 0;
   MVertex::resetGlobalNumber();
   MElement::resetGlobalNumber();
 }
diff --git a/Geo/GModel.h b/Geo/GModel.h
index 2fe07200ce40d80f1d6d1507fa7386c0653d1334..7af51784c1e3054c43b464b30460fcc855040f55 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -44,15 +44,19 @@ class GModel
 
  public:
   GModel(const std::string &name) : modelName(name), normals(0) {}
-  virtual ~GModel();
-
-  virtual void import(){}
+  virtual ~GModel(){ destroy(); }
 
   typedef std::set<GRegion*, GEntityLessThan>::iterator riter;
   typedef std::set<GFace*, GEntityLessThan>::iterator fiter;
   typedef std::set<GEdge*, GEntityLessThan>::iterator eiter;
   typedef std::set<GVertex*, GEntityLessThan>::iterator viter;
 
+  // Deletes everything in a GModel 
+  virtual void destroy();
+
+  // Imports data into a GModel from an external source
+  virtual void import(){}
+
   // Returns the geometric tolerance for the entire model.
   virtual double tolerance() const { return 1.e-14; }
 
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 2ea599b17cc4c3fabd4c926006843768b1e59f99..f18b51747acb4ed1ef7bd84dd9da3a00b38ebb14 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Geo.cpp,v 1.54 2006-08-13 20:46:54 geuzaine Exp $
+// $Id: Geo.cpp,v 1.55 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -100,6 +100,9 @@ void add_infile(char *text, char *fich)
   fprintf(file, "%s\n", text);
   fclose(file);
 
+  // we need to start from scratch since the command just parsed could
+  // have deleted some entities
+  GMODEL->destroy();
   GMODEL->import();
 }
 
diff --git a/Geo/gmshModel.cpp b/Geo/gmshModel.cpp
index d14775393b8307d9deb872acc9501f9ea14a6b3d..4ba63d8bc1735da30ff5e5490d49a771206e20ca 100644
--- a/Geo/gmshModel.cpp
+++ b/Geo/gmshModel.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshModel.cpp,v 1.12 2006-08-15 06:26:53 geuzaine Exp $
+// $Id: gmshModel.cpp,v 1.13 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -33,9 +33,6 @@ extern Mesh *THEM;
 
 void gmshModel::import()
 {
-  // When en entity that already exists is reimported, we don't do
-  // anything (except making it invisible if we are asked to)
-
   if(Tree_Nbr(THEM->Points)) {
     List_T *points = Tree2List(THEM->Points);
     for(int i = 0; i < List_Nbr(points); i++){
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 5865e4b097a091b33f7e1c3bae6117225c0ceff5..792673b957f690b53bbcdfb958d42f4b44ca5608 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.177 2006-08-18 15:13:34 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.178 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -821,8 +821,7 @@ void Draw_Mesh()
       if(status >= 1)
 	std::for_each(GMODEL->firstEdge(), GMODEL->lastEdge(), initMeshGEdge());
       if(status >= 2){
-	if(GMODEL->normals) 
-	  delete GMODEL->normals;
+	if(GMODEL->normals) delete GMODEL->normals;
 	GMODEL->normals = new smooth_normals(CTX.mesh.angle_smooth_normals);
 	if(CTX.mesh.smooth_normals)
 	  std::for_each(GMODEL->firstFace(), GMODEL->lastFace(), initSmoothNormalsGFace());
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index 6ab4dbbf023196fe37e7d0baa19678f843b8d32e..3c7f847bfbf2aba3891d31c2868b4f19960002d8 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.113 2006-08-17 03:22:22 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.114 2006-08-18 17:49:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -344,9 +344,7 @@ void OpenProblem(char *name)
   }
   CTX.threads_lock = 1;
 
-  // recreate a brand new gmsh model
-  if(GMODEL) delete GMODEL;
-  GMODEL = new gmshModel;
+  GMODEL->destroy();
 
   Init_Mesh();