diff --git a/Common/Context.h b/Common/Context.h
index c93a0c74e2545f1702e8eb92962adbf72c5bb7ba..6e864ba277732418a102a931315acc876cb889cd 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -160,7 +160,6 @@ public :
     double normals, tangents;
     double scaling_factor;
     int auto_coherence;
-    int stl_create_elementary, stl_create_physical;
   } geom;
 
   // mesh options 
@@ -178,7 +177,7 @@ public :
     double quality;
     int quality_type, label_type;
     double quality_inf, quality_sup, radius_inf, radius_sup;
-    double scaling_factor, lc_factor, rand_factor,nb_elem_per_rc,min_elem_size_fact;
+    double scaling_factor, lc_factor, rand_factor;
     int dual, interactive;
     int light, light_two_side;
     int format, nbPartitions,nb_smoothing, algo2d, algo3d, order,algo_recombine;
@@ -197,6 +196,8 @@ public :
     char *triangle_options;
     int smooth_normals;
     double angle_smooth_normals;
+    double stl_distance_tol, dihedral_angle_tol;
+    int nb_elem_per_rc, min_elem_size_fact, edge_prolongation_threshold;
   } mesh;
 
   // post processing options 
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 0f9c36ad6d6cf01b49c0c89494a0b246a760bf21..aebacea5756adaf610e0fff6003f29c6f4728ff1 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -810,10 +810,6 @@ StringXNumber GeometryOptions_Number[] = {
 
   { F|O, "ScalingFactor" , opt_geometry_scaling_factor , 1.0 , 
     "Global geometry scaling factor" },
-  { F|O, "StlCreateElementary" , opt_geometry_stl_create_elementary , 0. ,
-    "Treat each STL input face as a new geometrical surface" },
-  { F|O, "StlCreatePhysical" , opt_geometry_stl_create_physical , 1. ,
-    "Automatically create physical entities when importing STL faces as geometrical surfaces" },
   { F|O, "Surfaces" , opt_geometry_surfaces , 0. , 
     "Display geometry surfaces?" },
   { F|O, "SurfaceNumbers" , opt_geometry_surfaces_num , 0. , 
@@ -863,9 +859,13 @@ StringXNumber MeshOptions_Number[] = {
   { F,   "CutPlaneD" , opt_mesh_cut_planed , 0.0 , 
     "Fourth cut plane equation coefficient (`D' in `AX+BY+CZ+D=0')" },
 
+  { F|O, "DihedralAngleTol" , opt_mesh_dihedral_angle_tol, 22. ,
+    "Dihedral angle tolerance for edge creation in the remesher" },
   { F|O, "Dual" , opt_mesh_dual , 0. ,
     "Display the dual mesh obtained by barycentric subdivision" },
 
+  { F|O, "EdgeProlongationThreshold" , opt_mesh_edge_prolongation_threshold, 1. ,
+    "Edge prolongation threshold in the remesher" },
   { F|O, "ElementOrder" , opt_mesh_order , 1. , // "Order" is already a lex token
     "Element order (1=linear elements, 2=quadratic elements)" },
   { F|O, "Explode" , opt_mesh_explode , 1.0 ,
@@ -964,6 +964,8 @@ StringXNumber MeshOptions_Number[] = {
     "Smooth the mesh normals?" },
   { F|O, "SpeedMax" , opt_mesh_speed_max , 0. ,
     "Disable dubious point insertion tests" },
+  { F|O, "StlDistanceTol" , opt_mesh_stl_distance_tol, 5.e-7 ,
+    "Distance tolerance between two distinct vertices in STL meshes" },
   { F|O, "SurfaceEdges" , opt_mesh_surfaces_edges , 1. , 
     "Display edges of surface mesh?" },
   { F|O, "SurfaceFaces" , opt_mesh_surfaces_faces , 0. , 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 4c637ed4433ecf3e2a073bf84c654737fa26619c..2bc9aa9925a2bc5f731a618eba7edf78e82ad92f 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.259 2005-10-09 17:45:37 geuzaine Exp $
+// $Id: Options.cpp,v 1.260 2005-10-15 19:06:08 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -3929,20 +3929,6 @@ double opt_geometry_scaling_factor(OPT_ARGS_NUM)
   return CTX.geom.scaling_factor;
 }
 
-double opt_geometry_stl_create_elementary(OPT_ARGS_NUM)
-{
-  if(action & GMSH_SET)
-    CTX.geom.stl_create_elementary = (int)val;
-  return CTX.geom.stl_create_elementary;
-}
-
-double opt_geometry_stl_create_physical(OPT_ARGS_NUM)
-{
-  if(action & GMSH_SET)
-    CTX.geom.stl_create_physical = (int)val;
-  return CTX.geom.stl_create_physical;
-}
-
 double opt_mesh_optimize(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
@@ -4378,14 +4364,46 @@ double opt_mesh_format(OPT_ARGS_NUM)
   return CTX.mesh.format;
 }
 
+double opt_mesh_stl_distance_tol(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX.mesh.stl_distance_tol = val;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI))
+    WID->mesh_value[19]->value(CTX.mesh.stl_distance_tol);
+#endif
+  return CTX.mesh.stl_distance_tol;
+}
+
+double opt_mesh_dihedral_angle_tol(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX.mesh.dihedral_angle_tol = val;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI))
+    WID->mesh_value[20]->value(CTX.mesh.dihedral_angle_tol);
+#endif
+  return CTX.mesh.dihedral_angle_tol;
+}
+
+double opt_mesh_edge_prolongation_threshold(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX.mesh.edge_prolongation_threshold = (int)val;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI))
+    WID->mesh_value[21]->value(CTX.mesh.edge_prolongation_threshold);
+#endif
+  return CTX.mesh.edge_prolongation_threshold;
+}
 
 double opt_mesh_nb_elem_per_rc(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
-    CTX.mesh.nb_elem_per_rc = (double)val;
+    CTX.mesh.nb_elem_per_rc = (int)val;
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI))
-    WID->swiz_value[4]->value(CTX.mesh.nb_elem_per_rc);
+    WID->mesh_value[22]->value(CTX.mesh.nb_elem_per_rc);
 #endif
   return CTX.mesh.nb_elem_per_rc;
 }
@@ -4393,10 +4411,10 @@ double opt_mesh_nb_elem_per_rc(OPT_ARGS_NUM)
 double opt_mesh_min_elem_size_fact(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
-    CTX.mesh.min_elem_size_fact = (double)val;
+    CTX.mesh.min_elem_size_fact = (int)val;
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI))
-    WID->swiz_value[3]->value(CTX.mesh.min_elem_size_fact);
+    WID->mesh_value[23]->value(CTX.mesh.min_elem_size_fact);
 #endif
   return CTX.mesh.min_elem_size_fact;
 }
diff --git a/Common/Options.h b/Common/Options.h
index 5b56b541d59b93efd2a6aea6801e50d61568992f..81c4a166588ab28bc989ab2c75808726e8d5bcbe 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -401,8 +401,6 @@ double opt_geometry_circle_points(OPT_ARGS_NUM);
 double opt_geometry_circle_warning(OPT_ARGS_NUM);
 double opt_geometry_extrude_spline_points(OPT_ARGS_NUM);
 double opt_geometry_scaling_factor(OPT_ARGS_NUM);
-double opt_geometry_stl_create_elementary(OPT_ARGS_NUM);
-double opt_geometry_stl_create_physical(OPT_ARGS_NUM);
 double opt_mesh_optimize(OPT_ARGS_NUM);
 double opt_mesh_quality(OPT_ARGS_NUM);
 double opt_mesh_normals(OPT_ARGS_NUM);
@@ -439,8 +437,11 @@ double opt_mesh_light_two_side(OPT_ARGS_NUM);
 double opt_mesh_format(OPT_ARGS_NUM);
 double opt_mesh_msh_file_version(OPT_ARGS_NUM);
 double opt_mesh_nb_smoothing(OPT_ARGS_NUM);
+double opt_mesh_stl_distance_tol(OPT_ARGS_NUM);
 double opt_mesh_nb_elem_per_rc(OPT_ARGS_NUM);
 double opt_mesh_min_elem_size_fact(OPT_ARGS_NUM);
+double opt_mesh_dihedral_angle_tol(OPT_ARGS_NUM);
+double opt_mesh_edge_prolongation_threshold(OPT_ARGS_NUM);
 double opt_mesh_nb_partitions(OPT_ARGS_NUM);
 double opt_mesh_algo2d(OPT_ARGS_NUM);
 double opt_mesh_recombine_algo(OPT_ARGS_NUM);
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index ff718830a8a44d1c041916ee7e24e8d6be2b9611..c2a7e0963912397d611c30f509dcad0330e7c717 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.372 2005-10-14 19:26:06 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.373 2005-10-15 19:06:08 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -836,118 +836,6 @@ void options_restore_defaults_cb(CALLBACK_ARGS)
   Draw();
 }
 
-void wizard_update_edges_cb(CALLBACK_ARGS)
-{
-  extern  void BDS_To_Mesh(Mesh *m);
-  if (THEM && THEM->bds && WID){
-    const double angle = WID->swiz_value[0]->value() * M_PI / 180;
-    const int nb       = (int) WID->swiz_value[3]->value();
-    THEM->bds->classify (angle, nb);
-    BDS_To_Mesh (THEM); 
-    Draw();
-  }
-}
-
-void wizard_update_more_edges_cb(CALLBACK_ARGS)
-{
-  Vertex *v;
-  Curve *c;
-  Surface *s;
-  int n,p[100];
-  extern  void BDS_To_Mesh(Mesh *m);
-
-  if (THEM && THEM->bds && WID) {
-    const double angle = WID->swiz_value[2]->value() * M_PI / 180;
-    const int nb_t  = (int)(WID->swiz_value[3]->value() * M_PI / 180);
-    THEM->bds->classify (angle,nb_t);
-    BDS_To_Mesh (THEM); 
-    Draw();
-    n=0;
-    while(1) {
-      Msg(STATUS3N, "Adding new Model Edges");
-      if(n == 0)
-	Msg(ONSCREEN, "Select Model Edges\n"
-	    "[Press 'q' to abort or 'e' end]");
-      if(n == 1)
-	Msg(ONSCREEN, "Select Model Edge\n"
-	    "[Press 'u' to undo last selection, 'q' to abort, 'e' end]");
-      char ib = SelectEntity(ENT_LINE, &v, &c, &s);
-      printf("ib = %c\n",ib);
-      if(ib == 'l') {
-	p[n++] = c->Num;
-	printf("line %d has been selected\n",c->Num);
-      }
-      if(ib == 'u') {
-	if(n > 0){
-	  ZeroHighlightEntityNum(p[n-1], 0, 0);
-	  Draw();
-	  n--;
-	}
-      }
-      if(ib == 'q') {
-	ZeroHighlight(THEM);
-	Draw(); 
-	Msg(ONSCREEN, "");
-	Msg(STATUS3N, "Ready");
-	const double angle = WID->swiz_value[0]->value() * M_PI / 180;
-	THEM->bds->classify (angle,nb_t);
-	BDS_To_Mesh (THEM); 
-	Draw();
-	break;
-      }
-      if(ib == 'e') {
-	for (int i=0;i<n;i++) {
-	  BDS_GeomEntity *g = THEM->bds->get_geom(p[i],1);
-	  std::list<BDS_Edge*>::iterator it  = g->e.begin();
-	  std::list<BDS_Edge*>::iterator ite = g->e.end();
-	  while (it!=ite){			
-	    BDS_Edge *e = (*it);
-	    e->status = 1;
-	    ++it;
-	  }
-	}
-	
-	ZeroHighlight(THEM);
-	Draw();
-	n = 0;
-      }
-    }
-  }
-}
-
-void wizard_update_tolerance_cb(CALLBACK_ARGS)
-{
-  extern  void BDS_To_Mesh(Mesh *m);    
-  
-  if (THEM && THEM->bds && WID) {
-    const double tol = WID->swiz_value[1]->value();
-    if (THEM->bds)delete THEM->bds;
-    THEM->bds = new BDS_Mesh;
-    printf("reading file %s\n",WID->surfmesh_filename.c_str());
-    THEM->bds->read_stl ( WID->surfmesh_filename.c_str(), tol );
-    BDS_To_Mesh (THEM); 
-    SetBoundingBox(); 
-    char a[25];
-    sprintf(a,"%d",THEM->bds->points.size());
-    WID->swiz_output[0]->value(a);
-    Draw();
-  }
-}
-
-void wizard_update_next_cb(CALLBACK_ARGS)
-{
-  if (WID) {
-    WID->swiz_wiz->next();
-  }
-}
-
-void wizard_update_prev_cb(CALLBACK_ARGS)
-{
-  if (WID) {
-    WID->swiz_wiz->prev();
-  }
-}
-
 void options_ok_cb(CALLBACK_ARGS)
 {
   general_options_ok_cb(w, data);
@@ -1155,8 +1043,7 @@ void mesh_options_ok_cb(CALLBACK_ARGS)
   opt_mesh_light(0, GMSH_SET, WID->mesh_butt[17]->value());
   opt_mesh_light_two_side(0, GMSH_SET, WID->mesh_butt[18]->value());
   opt_mesh_smooth_normals(0, GMSH_SET, WID->mesh_butt[19]->value());
-  opt_mesh_nb_elem_per_rc(0, GMSH_SET, WID->swiz_value[4]->value());
-  opt_mesh_min_elem_size_fact(0, GMSH_SET, WID->swiz_value[3]->value());
+
   opt_mesh_nb_smoothing(0, GMSH_SET, WID->mesh_value[0]->value());
   opt_mesh_scaling_factor(0, GMSH_SET, WID->mesh_value[1]->value());
   opt_mesh_lc_factor(0, GMSH_SET, WID->mesh_value[2]->value());
@@ -1176,6 +1063,11 @@ void mesh_options_ok_cb(CALLBACK_ARGS)
   opt_mesh_cut_planec(0, GMSH_SET, WID->mesh_value[16]->value());
   opt_mesh_cut_planed(0, GMSH_SET, WID->mesh_value[17]->value());
   opt_mesh_angle_smooth_normals(0, GMSH_SET, WID->mesh_value[18]->value());
+  opt_mesh_stl_distance_tol(0, GMSH_SET, WID->mesh_value[19]->value());
+  opt_mesh_dihedral_angle_tol(0, GMSH_SET, WID->mesh_value[20]->value());
+  opt_mesh_edge_prolongation_threshold(0, GMSH_SET, WID->mesh_value[21]->value());
+  opt_mesh_nb_elem_per_rc(0, GMSH_SET, WID->mesh_value[22]->value());
+  opt_mesh_min_elem_size_fact(0, GMSH_SET, WID->mesh_value[23]->value());
 
   opt_mesh_point_type(0, GMSH_SET, WID->mesh_choice[0]->value());
   opt_mesh_line_type(0, GMSH_SET, WID->mesh_choice[1]->value());
@@ -2808,7 +2700,7 @@ void mesh_3d_cb(CALLBACK_ARGS)
   Msg(STATUS3N, "Ready");
 }
 
-void mesh_remesh(CALLBACK_ARGS)
+void mesh_remesh_cb(CALLBACK_ARGS)
 {
   ReMesh(THEM);
   Draw();
@@ -2846,6 +2738,83 @@ void mesh_optimize_cb(CALLBACK_ARGS)
   Msg(STATUS3N, "Ready");
 }
 
+void mesh_update_edges_cb(CALLBACK_ARGS)
+{
+  extern  void BDS_To_Mesh(Mesh *m);
+  if(THEM && THEM->bds){
+    THEM->bds->classify(CTX.mesh.dihedral_angle_tol * M_PI/180,
+			CTX.mesh.edge_prolongation_threshold);
+    BDS_To_Mesh (THEM); 
+    Draw();
+  }
+}
+
+void mesh_update_more_edges_cb(CALLBACK_ARGS)
+{
+  Vertex *v;
+  Curve *c;
+  Surface *s;
+  int n, p[100];
+  extern void BDS_To_Mesh(Mesh *m);
+
+  if (THEM && THEM->bds && WID) {
+    const double angle = CTX.mesh.dihedral_angle_tol * M_PI / 180;
+    const int nb_t = CTX.mesh.edge_prolongation_threshold;
+    THEM->bds->classify(angle, nb_t);
+    BDS_To_Mesh (THEM); 
+    Draw();
+    n=0;
+    while(1) {
+      Msg(STATUS3N, "Adding new Model Edges");
+      if(n == 0)
+	Msg(ONSCREEN, "Select Model Edges\n"
+	    "[Press 'q' to abort or 'e' end]");
+      if(n == 1)
+	Msg(ONSCREEN, "Select Model Edge\n"
+	    "[Press 'u' to undo last selection, 'q' to abort, 'e' end]");
+      char ib = SelectEntity(ENT_LINE, &v, &c, &s);
+      printf("ib = %c\n",ib);
+      if(ib == 'l') {
+	p[n++] = c->Num;
+	printf("line %d has been selected\n",c->Num);
+      }
+      if(ib == 'u') {
+	if(n > 0){
+	  ZeroHighlightEntityNum(p[n-1], 0, 0);
+	  Draw();
+	  n--;
+	}
+      }
+      if(ib == 'q') {
+	ZeroHighlight(THEM);
+	Draw(); 
+	Msg(ONSCREEN, "");
+	Msg(STATUS3N, "Ready");
+	THEM->bds->classify(angle, nb_t);
+	BDS_To_Mesh(THEM); 
+	Draw();
+	break;
+      }
+      if(ib == 'e') {
+	for (int i=0;i<n;i++) {
+	  BDS_GeomEntity *g = THEM->bds->get_geom(p[i],1);
+	  std::list<BDS_Edge*>::iterator it  = g->e.begin();
+	  std::list<BDS_Edge*>::iterator ite = g->e.end();
+	  while (it!=ite){			
+	    BDS_Edge *e = (*it);
+	    e->status = 1;
+	    ++it;
+	  }
+	}
+	
+	ZeroHighlight(THEM);
+	Draw();
+	n = 0;
+      }
+    }
+  }
+}
+
 void mesh_define_length_cb(CALLBACK_ARGS)
 {
   Vertex *v;
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index aeb0a8eb897b06035e6d6ba3b920fbe4cb89db9d..3df6b606d072d95129085907d4b7f3ad72da0089 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -271,7 +271,9 @@ void mesh_define_cb(CALLBACK_ARGS);
 void mesh_1d_cb(CALLBACK_ARGS);
 void mesh_2d_cb(CALLBACK_ARGS); 
 void mesh_3d_cb(CALLBACK_ARGS); 
-void mesh_remesh(CALLBACK_ARGS); 
+void mesh_remesh_cb(CALLBACK_ARGS); 
+void mesh_update_edges_cb(CALLBACK_ARGS); 
+void mesh_update_more_edges_cb(CALLBACK_ARGS);
 void mesh_degree_cb(CALLBACK_ARGS); 
 void mesh_optimize_cb(CALLBACK_ARGS); 
 void mesh_define_length_cb (CALLBACK_ARGS);
@@ -293,12 +295,5 @@ void solver_kill_cb(CALLBACK_ARGS);
 void solver_choose_executable_cb(CALLBACK_ARGS);
 void solver_ok_cb(CALLBACK_ARGS);
 
-// SURFACE MESH WIZARD
-
-void wizard_update_more_edges_cb(CALLBACK_ARGS);
-void wizard_update_edges_cb(CALLBACK_ARGS);
-void wizard_update_tolerance_cb(CALLBACK_ARGS);
-void wizard_update_prev_cb(CALLBACK_ARGS);
-void wizard_update_next_cb(CALLBACK_ARGS);
 #endif
 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 044091bc60238192dcb1e5d76b1e9841392a87b5..faaa653cfff8dcac9da79c3f34f332a1b9d78985 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.459 2005-10-14 19:26:06 geuzaine Exp $
+// $Id: GUI.cpp,v 1.460 2005-10-15 19:06:09 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -324,12 +324,14 @@ Context_Item menu_mesh[] = {
   { "1D",     (Fl_Callback *)mesh_1d_cb } ,
   { "2D",     (Fl_Callback *)mesh_2d_cb } , 
   { "3D",     (Fl_Callback *)mesh_3d_cb } , 
-  { "Remesh", (Fl_Callback *)mesh_remesh } , 
   { "First order",  (Fl_Callback *)mesh_degree_cb, (void*)1 } , 
   { "Second order", (Fl_Callback *)mesh_degree_cb, (void*)2 } , 
 #if defined(HAVE_NETGEN)
   { "Optimize quality", (Fl_Callback *)mesh_optimize_cb } , 
 #endif
+  { "Update STL edges", (Fl_Callback *)mesh_update_edges_cb } , 
+  { "Add STL edges", (Fl_Callback *)mesh_update_more_edges_cb } , 
+  { "Remesh STL", (Fl_Callback *)mesh_remesh_cb } , 
   { "Save",   (Fl_Callback *)mesh_save_cb } ,
   { NULL } 
 };  
@@ -815,7 +817,6 @@ GUI::GUI(int argc, char **argv)
   int i;
 
   // initialize static windows
-  swiz_window = NULL;
   m_window = NULL;
   g_window = NULL;
   opt_window = NULL;
@@ -2225,53 +2226,39 @@ void GUI::create_option_window()
     }
 
     {
-      Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Remesher");
+      Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "STL");
       o->hide();
-      // In STL FILES, points have to be merged and a distance tolerance has to be set 
-      swiz_value[1] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Distance Tolerance (for STL inputs)");
-      swiz_value[1]->value(5.e-7);
-      swiz_value[1]->minimum(0);
-      swiz_value[1]->maximum(1.e-4);
-      swiz_value[1]->step(1.e-7);
-      swiz_value[1]->align(FL_ALIGN_RIGHT);
-      // when this button is pushed, the STL file is re-loaded
-      mesh_retbutt[0] = new Fl_Return_Button(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Reload");
-      mesh_retbutt[0]->callback(wizard_update_tolerance_cb);
-
-      // The number of nodes after merge is computed 
-      swiz_output[0] = new Fl_Output(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Number of Nodes after Merge");
-      swiz_output[0]->align(FL_ALIGN_RIGHT);
-      swiz_output[0]->value("0");
-      // If no geometry is provided, then the triangulation can be used for computing a discrete geometry
-      // The dihedral angle between neighboring triangles can be used to find model edges.
-      swiz_value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Treshold Dihedral Angle");
-      swiz_value[0]->value(180/8);
-      swiz_value[0]->minimum(0);
-      swiz_value[0]->maximum(90);
-      swiz_value[0]->step(1);
-      swiz_value[0]->align(FL_ALIGN_RIGHT);
-      swiz_value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Edge prolongation treshold");
-      swiz_value[3]->value(180/8);
-      swiz_value[3]->minimum(0);
-      swiz_value[3]->maximum(90);
-      swiz_value[3]->step(1);
-      swiz_value[3]->align(FL_ALIGN_RIGHT); 
-
-      mesh_retbutt[1] = new Fl_Return_Button(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Re-Classify");
-      mesh_retbutt[1]->callback(wizard_update_edges_cb);
-
-      swiz_value[4] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Number of elements per rad. of curv.");
-      swiz_value[4]->value(5);
-      swiz_value[4]->minimum(1);
-      swiz_value[4]->maximum(10);
-      swiz_value[4]->step(1);
-      swiz_value[4]->align(FL_ALIGN_RIGHT); 
-      swiz_value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "LC/Minimum element size");
-      swiz_value[3]->value(500);
-      swiz_value[3]->minimum(10);
-      swiz_value[3]->maximum(10000);
-      swiz_value[3]->step(10);
-      swiz_value[3]->align(FL_ALIGN_RIGHT); 
+
+      mesh_value[19] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Vertex distance tolerance");
+      mesh_value[19]->minimum(0);
+      mesh_value[19]->maximum(1.e-3);
+      mesh_value[19]->step(1.e-7);
+      mesh_value[19]->align(FL_ALIGN_RIGHT);
+
+      mesh_value[20] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Dihedral angle threshold");
+      mesh_value[20]->minimum(0);
+      mesh_value[20]->maximum(90);
+      mesh_value[20]->step(1);
+      mesh_value[20]->align(FL_ALIGN_RIGHT);
+
+      mesh_value[21] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Edge prolongation threshold");
+      mesh_value[21]->minimum(0);
+      mesh_value[21]->maximum(100);
+      mesh_value[21]->step(1);
+      mesh_value[21]->align(FL_ALIGN_RIGHT); 
+
+      mesh_value[22] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Number of elements per rad. of curv.");
+      mesh_value[22]->minimum(1);
+      mesh_value[22]->maximum(10);
+      mesh_value[22]->step(1);
+      mesh_value[22]->align(FL_ALIGN_RIGHT); 
+
+      mesh_value[23] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "LC/Minimum element size");
+      mesh_value[23]->minimum(10);
+      mesh_value[23]->maximum(10000);
+      mesh_value[23]->step(10);
+      mesh_value[23]->align(FL_ALIGN_RIGHT); 
+
       o->end();
     }
 
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index f8350a1da45f5b46c65e64ed55b63274b5873930..8f616a05f53a2d7d35dbb02961913a90e0cdee46 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -40,7 +40,6 @@
 #include <FL/Fl_Output.H>
 #include <FL/Fl_Multiline_Output.H>
 #include <FL/Fl_Bitmap.H>
-#include <FL/Fl_Wizard.H>
 #include <FL/Fl_Browser.H>
 #include <FL/Fl_Multi_Browser.H>
 #include <FL/Fl_Hold_Browser.H>
@@ -156,16 +155,6 @@ public:
   Fl_Button        *g_status_butt[8] ;
   Fl_Box           *g_status_label[3] ;
 
-  // Surface mesh Wizard  window
-  Fl_Window        *swiz_window ;
-  Fl_Wizard        *swiz_wiz ;
-  Fl_Check_Button  *swiz_butt[20] ;
-  Fl_Button        *swiz_push_butt[20] ;
-  Fl_Value_Input   *swiz_value[50] ;
-  Fl_Input         *swiz_input[20] ;
-  Fl_Output        *swiz_output[20] ;
-  Fl_Choice        *swiz_choice[20] ;  
-  std::string surfmesh_filename;
   // Option window
   Fl_Window        *opt_window ;
   Fl_Hold_Browser  *opt_browser ;
@@ -192,7 +181,7 @@ public:
   Fl_Check_Button  *mesh_butt[50] ;
   Fl_Return_Button *mesh_retbutt[50] ;
   Fl_Input         *mesh_input[20] ;
-  Fl_Value_Input   *mesh_value[20] ;
+  Fl_Value_Input   *mesh_value[50] ;
   Fl_Button        *mesh_col[50] ;
   Fl_Choice        *mesh_choice[20] ;
 
@@ -272,7 +261,6 @@ public:
   void create_menu_window();
   void create_graphic_window();
   void create_option_window();
-  void create_surface_mesh_wizard(const char * = 0);
   void hide_all_option_groups();
   void create_general_options_window();
   void create_geometry_options_window();
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index b77348318b7000f2a8f8b424390ff505e5d5bd4b..8415c828d56f9b7d0099b12d51de69ad05814034 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.83 2005-09-21 15:03:47 remacle Exp $
+// $Id: OpenFile.cpp,v 1.84 2005-10-15 19:06:09 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -284,27 +284,12 @@ int MergeProblem(char *name, int warn_if_missing)
     if (THEM->bds)delete THEM->bds;
     THEM->bds = new BDS_Mesh;
     if(!strcmp(ext, ".mesh"))
-    {
-      THEM->bds->read_mesh ( name );
-#if defined(HAVE_FLTK)
-      WID->swiz_value[1]->deactivate();
-      WID->mesh_retbutt[0]->deactivate();
-#endif
-    }
+      THEM->bds->read_mesh(name);
     else
-    {
-      THEM->bds->read_stl ( name , 5.e-7);
-#if defined(HAVE_FLTK)
-#endif
-    }
-#if defined(HAVE_FLTK)
-    WID->surfmesh_filename = name; 
-#endif
-    //    THEM->bds->save_gmsh_format ( "1.msh" );
-    THEM->bds->classify ( M_PI / 8 );
-    //    THEM->bds->save_gmsh_format ( "2.msh" );
-    BDS_To_Mesh (THEM);
-    THEM->bds_mesh = new BDS_Mesh (*THEM->bds);
+      THEM->bds->read_stl(name, CTX.mesh.stl_distance_tol);
+    THEM->bds->classify(CTX.mesh.dihedral_angle_tol * M_PI / 180);
+    BDS_To_Mesh(THEM);
+    THEM->bds_mesh = new BDS_Mesh(*THEM->bds);
     BDS_To_Mesh_2(THEM);
     THEM->status = 2;
     SetBoundingBox();
diff --git a/TODO b/TODO
index 8a60e5e31efd874a6e9cdf51b049aa48a3e2e7fb..d95b25f770a0f88058d9f233b533a035d0380f14 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,9 @@
-$Id: TODO,v 1.102 2005-10-09 17:45:37 geuzaine Exp $
+$Id: TODO,v 1.103 2005-10-15 19:06:08 geuzaine Exp $
+
+********************************************************************
+
+Would be nice to have a routine to save a post-processing view as a
+mesh file (in MSH format)
 
 ********************************************************************