diff --git a/Mesh/BDS.cpp b/Mesh/BDS.cpp
index f4cd1112e414c53ca15cbf92c2e1e43981ca7bd1..2bdac3169170bdd26dc6b2557f81e312fbbbdd1c 100644
--- a/Mesh/BDS.cpp
+++ b/Mesh/BDS.cpp
@@ -1,4 +1,4 @@
-// $Id: BDS.cpp,v 1.69 2006-12-01 16:16:50 remacle Exp $
+// $Id: BDS.cpp,v 1.70 2006-12-05 14:22:05 remacle Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -1005,8 +1005,8 @@ bool test_move_point_parametric_triangle (BDS_Point * p, double u, double v, BDS
   double area_final = fabs(a[1] * b[2] - a[2] * b[1]);
   if (area_final < 0.1 * area_init)return false;
   double ori_final = gmsh::orient2d(pa, pb, pc);
-
-  return ori_init*ori_final > 0;
+  // allow to move a point when a triangle was flat
+  return ori_init*ori_final >= 0;
 }
 
 bool BDS_Mesh::smooth_point_parametric(BDS_Point * p, GFace *gf)
diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index e37954d66cf2e43a4d561aa959d4b1ca291db1fd..e78d4f19701d0b022fa2af4a8b7d246cfc1685e4 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: BackgroundMesh.cpp,v 1.9 2006-11-30 18:06:58 geuzaine Exp $
+// $Id: BackgroundMesh.cpp,v 1.10 2006-12-05 14:22:05 remacle Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -179,7 +179,7 @@ double BGM_MeshSize ( GEntity *ge, double U, double V , double X, double Y, doub
   double l1 = 1.e22;
 
   if(CTX.mesh.lc_from_curvature && ge->dim() < 3)
-    l1 = std::max(l3/300,LC_MVertex_CURV ( ge, U, V ));
+    l1 = std::max(l3/100,LC_MVertex_CURV ( ge, U, V ));
 
   return std::min(l,l1) ;
 }
diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp
index 60c3f0b416a8ee87546a82f294e7460067731227..ec0c2c0cbba1ac9dc7c37a901b4049eb0eedde22 100644
--- a/Mesh/meshGEdge.cpp
+++ b/Mesh/meshGEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGEdge.cpp,v 1.23 2006-11-30 11:32:26 remacle Exp $
+// $Id: meshGEdge.cpp,v 1.24 2006-12-05 14:22:05 remacle Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -222,7 +222,7 @@ void meshGEdge :: operator() (GEdge *ge)
   
   // first compute the length of the curve by integrating one
   _myGEdgeLength = Integration(_myGEdgeBounds.low(), _myGEdgeBounds.high(), 
-			       F_One, Points, 1.e-4);
+			       F_One, Points, 1.e-8);
   ge->setLength (_myGEdgeLength);
 
   List_Reset(Points);
@@ -235,12 +235,12 @@ void meshGEdge :: operator() (GEdge *ge)
   int N;
   if(ge->meshAttributes.Method == TRANSFINI){
     a = Integration(_myGEdgeBounds.low(), _myGEdgeBounds.high(), 
-		    F_Transfinite, Points, 1.e-7);
+		    F_Transfinite, Points, 1.e-8);
     N = ge->meshAttributes.nbPointsTransfinite;
   }
   else{
     a = Integration(_myGEdgeBounds.low(), _myGEdgeBounds.high(), 
-		    F_Lc, Points, 1.e-4);
+		    F_Lc, Points, 1.e-8);
     N = std::max(ge->minimumMeshSegments() + 1, (int)(a + 1.));
   }
   const double b = a / (double)(N - 1);
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index bde0721acbe147d5b7361c52a32a9c55f693b211..5b3e4dad406d0bf73d7f0c24f20a407122883520 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.37 2006-12-03 00:04:31 geuzaine Exp $
+// $Id: meshGFace.cpp,v 1.38 2006-12-05 14:22:05 remacle Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -273,6 +273,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
     }
 
 
+  double OLDminL=1.E22,OLDmaxL=0;
   while (1)
     {
     //   double stot = 0;
@@ -313,8 +314,10 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
 	  ++it;
 	}
 
+      if (OLDminL == minL && OLDmaxL == maxL)break;
+      OLDminL = minL;OLDmaxL = maxL;
 
-      if ((minL > 0.4 && maxL < 1.5) || IT > NIT)break;
+      if ((minL > 1./sqrt(2.0) && maxL < sqrt(2.0)) || IT > NIT)break;
 
 
       NN1 = m.edges.size();
@@ -336,12 +339,12 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
 				     coord * (*it)->p1->u + (1 - coord) * (*it)->p2->u,
 				     coord * (*it)->p1->v + (1 - coord) * (*it)->p2->v,gf);
 		  double l1 = 0.5 * ( (*it)->p1->lc() +  (*it)->p2->lc() );
-		  double l2 = BGM_MeshSize(gf,
- 					   (coord * (*it)->p1->u + (1 - coord) * (*it)->p2->u)*m.scalingU,
- 					   (coord * (*it)->p1->v + (1 - coord) * (*it)->p2->v)*m.scalingV,
-					   mid->X,mid->Y,mid->Z);
-		  mid->lc() = std::min(l1,l2);
-		  //mid->lc() = l2;
+// 		  double l2 = BGM_MeshSize(gf,
+//  					   (coord * (*it)->p1->u + (1 - coord) * (*it)->p2->u)*m.scalingU,
+//  					   (coord * (*it)->p1->v + (1 - coord) * (*it)->p2->v)*m.scalingV,
+// 					   mid->X,mid->Y,mid->Z);
+//		  mid->lc() = std::min(l1,l2);
+		  mid->lc() = l1;
 		  m.split_edge ( *it, mid );
 		  nb_split++;
 		} 
@@ -422,14 +425,49 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
 	      ++itp;
 	    }
 	}
-	IT++;
-	Msg(DEBUG1," iter %d minL %g maxL %g %d split %d swap %d collapse %d smooth",IT,minL,maxL,nb_split,nb_swap,nb_collaps,nb_smooth);
+	// recompute mesh sizes takin into account curvature , BGMESH & co
 	m.cleanup();  
+	if (IT % 5 == 0 && (CTX.mesh.lc_from_curvature || BGMExists()))
+	{
+	  std::set<BDS_Point*,PointLessThan>::iterator itp = m.points.begin();
+	  while (itp != m.points.end())
+	    {
+	      BDS_Point *p = *itp;
+	      if(p->g->classif_degree == 2)
+		{
+		  double l2 = BGM_MeshSize(gf,p->u*m.scalingU,p->v*m.scalingV,p->X,p->Y,p->Z);
+		  p->config_modified = true;
+		  p->lc() = std::min(p->lc(),l2);
+		}
+	      ++itp;
+	    }
+	  for (int ITERA = 0;ITERA< 6; ITERA++);
+	  {
+	    it = m.edges.begin();
+	    while (it != m.edges.end())
+	      {
+		BDS_Edge *e = *it;
+		if (!e->deleted)
+		  {
+		    double l1 = e->p1->lc();
+		    double l2 = e->p2->lc();
+		    if (l1 > 1.3 *l2) e->p1->lc() = 1.5*l2;
+		    if (l2 > 1.3 *l1) e->p2->lc() = 1.5*l1;
+		  }
+		++it;
+	      }
+	  }
+	}
+	IT++;
+
+	Msg(DEBUG1," iter %3d minL %8.3f maxL %8.3f : %6d splits, %6d swaps, %6d collapses, %6d moves",IT,minL,maxL,nb_split,nb_swap,nb_collaps,nb_smooth);
+	if (nb_split==0 && nb_collaps == 0)break;
     }  
 }
 
 
 
+
 bool recover_medge ( BDS_Mesh *m, GEdge *ge)
 {
 
@@ -771,7 +809,7 @@ void gmsh2DMeshGenerator ( GFace *gf )
   // goto hhh;
    // start mesh generation
 
-  RefineMesh (gf,*m,15);
+  RefineMesh (gf,*m,100);
   //  OptimizeMesh (gf,*m,2);
 
 
@@ -1246,7 +1284,7 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
   // goto hhh;
   // start mesh generation
   
-  RefineMesh (gf,*m,15);
+  RefineMesh (gf,*m,100);
   //  OptimizeMesh (gf,*m,2);