diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index 2998a7ffe98b48221b3faaaa3189e49d7b34a439..cfea30bc26572a5582a30f8c7aa669e85c9a9a50 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.78 2005-05-21 04:55:59 geuzaine Exp $
+// $Id: Main.cpp,v 1.79 2005-06-10 00:31:28 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -67,14 +67,14 @@ int main(int argc, char *argv[])
     strcat(cmdline, " ");
   }
 
-  // Gmsh default options
-
-  Init_Options(0);
-
   // Initialize the static Mesh
   
   Init_Mesh0(&M);
 
+  // Gmsh default options
+
+  Init_Options(0);
+
   // Generate automatic documentation (before getting user-defined options)
   
   if(argc == 2 && !strcmp(argv[1], "-doc")){
diff --git a/Mesh/2D_Recombine.cpp b/Mesh/2D_Recombine.cpp
index 3827e4c620efe5dc15c560f4c4608316e3959310..05450a548b251758a9f3c90bf6e20ad93348f558 100644
--- a/Mesh/2D_Recombine.cpp
+++ b/Mesh/2D_Recombine.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Recombine.cpp,v 1.24 2005-06-09 22:19:02 geuzaine Exp $
+// $Id: 2D_Recombine.cpp,v 1.25 2005-06-10 00:31:28 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -21,7 +21,9 @@
 
 #include "Gmsh.h"
 #include "Numeric.h"
+#include "Geo.h"
 #include "Mesh.h"
+#include "Interpolation.h"
 #include "Utils.h"
 #include "2D_Mesh.h"
 #include "Create.h"
@@ -236,12 +238,25 @@ int Recombine_All (Mesh *THEM)
       for(int j=0 ; j<List_Nbr(Triangles); j++){
 	Simplex *t;
 	List_Read(Triangles, j, &t);
-	Vertex *c = Create_Vertex(++THEM->MaxPointNum, 
-				  (t->V[0]->Pos.X+t->V[1]->Pos.X+t->V[2]->Pos.X)/3.,
-				  (t->V[0]->Pos.Y+t->V[1]->Pos.Y+t->V[2]->Pos.Y)/3.,
-				  (t->V[0]->Pos.Z+t->V[1]->Pos.Z+t->V[2]->Pos.Z)/3.,
-				  (t->V[0]->lc+t->V[1]->lc+t->V[2]->lc)/3.,
-				  (t->V[0]->u+t->V[1]->u+t->V[2]->u)/3.);
+	Vertex *c;
+	if(s->Typ == MSH_SURF_PLAN || s->Typ == MSH_SURF_DISCRETE){
+	  c = Create_Vertex(++THEM->MaxPointNum, 
+			    (t->V[0]->Pos.X+t->V[1]->Pos.X+t->V[2]->Pos.X)/3.,
+			    (t->V[0]->Pos.Y+t->V[1]->Pos.Y+t->V[2]->Pos.Y)/3.,
+			    (t->V[0]->Pos.Z+t->V[1]->Pos.Z+t->V[2]->Pos.Z)/3.,
+			    (t->V[0]->lc+t->V[1]->lc+t->V[2]->lc)/3.,
+			    (t->V[0]->u+t->V[1]->u+t->V[2]->u)/3.);
+	}
+	else{
+	  double U1, U2, U3, V1, V2, V3;
+	  XYZtoUV(s, t->V[0]->Pos.X, t->V[0]->Pos.Y, t->V[0]->Pos.Z, &U1, &V1, 1.0);
+	  XYZtoUV(s, t->V[1]->Pos.X, t->V[1]->Pos.Y, t->V[1]->Pos.Z, &U2, &V2, 1.0);
+	  XYZtoUV(s, t->V[2]->Pos.X, t->V[2]->Pos.Y, t->V[2]->Pos.Z, &U3, &V3, 1.0);
+	  double U = (U1 + U2 + U3)/.3;
+	  double V = (V1 + V2 + V3)/3.;
+	  Vertex v = InterpolateSurface(s, U, V, 0, 0);
+	  c = Create_Vertex(++THEM->MaxPointNum, v.Pos.X, v.Pos.Y, v.Pos.Z, v.lc, v.u);
+	}  
         Tree_Add(THEM->Vertices, &c);
 	Quadrangle *q1 = Create_Quadrangle(t->V[0], t->VSUP[0], c, t->VSUP[2]);
 	Quadrangle *q2 = Create_Quadrangle(t->V[1], t->VSUP[1], c, t->VSUP[0]);
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index acea144ab8b742cf52578f78e9f6a775333b4d58..143922f3f6a0e445af0ba50818f47ce6557d485e 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-// $Id: Generator.cpp,v 1.68 2005-06-09 22:27:18 geuzaine Exp $
+// $Id: Generator.cpp,v 1.69 2005-06-10 00:31:28 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -310,6 +310,7 @@ void Maillage_Dimension_3(Mesh * M)
 
 void Init_Mesh0(Mesh * M)
 {
+  THEM = M;
   M->bds = 0;
   M->bds_mesh = 0;
   M->Vertices = NULL;
@@ -330,7 +331,6 @@ void Init_Mesh0(Mesh * M)
 void Init_Mesh(Mesh * M)
 {
   THEM = M;
-
   M->MaxPointNum = 0;
   M->MaxLineNum = 0;
   M->MaxLineLoopNum = 0;
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 43cba5e7eb2f2a1e62b2b1c40a6e6844e3785eab..908e26e62856f3e1ae0d7add9e62bb35733d2e78 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.86 2005-06-03 17:32:29 geuzaine Exp $
+# $Id: Makefile,v 1.87 2005-06-10 00:31:28 geuzaine Exp $
 #
 # Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 #
@@ -153,10 +153,10 @@ depend:
 2D_Recombine.o: 2D_Recombine.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h ../Common/VertexArray.h \
-  ../Common/SmoothNormals.h Metric.h Matrix.h Utils.h 2D_Mesh.h Create.h \
-  ../Common/Context.h
+  ../Numeric/Numeric.h ../Geo/Geo.h Mesh.h Vertex.h Element.h Simplex.h \
+  Face.h Edge.h ../Geo/ExtrudeParams.h ../Common/VertexArray.h \
+  ../Common/SmoothNormals.h Metric.h Matrix.h Interpolation.h Utils.h \
+  2D_Mesh.h Create.h ../Common/Context.h
 # 1 "/Users/geuzaine/.gmsh/Mesh//"
 2D_InitMesh.o: 2D_InitMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \