diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp
index b92f0c4951af67730ebab4369bf49ec0ecdd0ee8..2b2b3b5e20682c6fd486bdd1deb2bf5aca3e35f1 100644
--- a/Geo/ChainComplex.cpp
+++ b/Geo/ChainComplex.cpp
@@ -244,7 +244,6 @@ void ChainComplex::Inclusion(int lowDim, int highDim)
   destroy_gmp_normal_form(normalForm);
   
   return;
-  
 }
 
 void ChainComplex::Quotient(int dim)
@@ -373,7 +372,6 @@ void ChainComplex::computeHomology(bool dual)
         
         gmp_matrix_right_mult(getHbasis(setDim), getQMatrix(lowDim));
       } 
-      
     } 
     
     destroy_gmp_matrix(getKerHMatrix(lowDim));
@@ -384,17 +382,14 @@ void ChainComplex::computeHomology(bool dual)
     setKerHMatrix(lowDim, NULL);
     setCodHMatrix(lowDim, NULL);
     setJMatrix(lowDim, NULL);
-    setQMatrix(lowDim, NULL);
-     
-  }
-  
-  
+    setQMatrix(lowDim, NULL);  
+  } 
   return;
 }
 
 
-void ChainComplex::matrixTest(){
-  
+void ChainComplex::matrixTest()
+{  
   int rows = 3;
   int cols = 6;
   
@@ -411,8 +406,8 @@ void ChainComplex::matrixTest(){
   return; 
 }
 
-std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber){
-  
+std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber)
+{  
   std::vector<int> coeffVector;
   
   if(dim < 0 || dim > 4) return coeffVector;
@@ -435,11 +430,11 @@ std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber){
   }
   
   mpz_clear(elem);
-  return coeffVector;
-  
+  return coeffVector;  
 }
 
-int ChainComplex::getTorsion(int dim, int chainNumber){
+int ChainComplex::getTorsion(int dim, int chainNumber)
+{
   if(dim < 0 || dim > 4) return 0;
   if(_Hbasis[dim] == NULL 
      || (int)gmp_matrix_cols(_Hbasis[dim]) < chainNumber) return 0;
@@ -450,8 +445,8 @@ int ChainComplex::getTorsion(int dim, int chainNumber){
 
 Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, 
 	     CellComplex* cellComplex, GModel* model,
-	     std::string name, int torsion){
-  
+	     std::string name, int torsion)
+{  
   int i = 0;
   for(std::set<Cell*, Less_Cell>::iterator cit = cells.begin();
       cit != cells.end(); cit++){
@@ -479,9 +474,9 @@ Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs,
   
 }
 
-bool Chain::deform(std::map<Cell*, int, Less_Cell> &cellsInChain, 
-		   std::map<Cell*, int, Less_Cell> &cellsNotInChain){
-
+bool Chain::deform(std::map<Cell*, int, Less_Cell>& cellsInChain, 
+		   std::map<Cell*, int, Less_Cell>& cellsNotInChain)
+{
   std::vector<int> cc;
   std::vector<int> bc;
   
@@ -518,8 +513,8 @@ bool Chain::deform(std::map<Cell*, int, Less_Cell> &cellsInChain,
   return true;
 }
 
-bool Chain::deformChain(std::pair<Cell*, int> cell, bool bend){
-  
+bool Chain::deformChain(std::pair<Cell*, int> cell, bool bend)
+{  
   Cell* c1 = cell.first;
   for(citer cit = c1->firstCoboundary(true); cit != c1->lastCoboundary(true);
       cit++){
@@ -582,7 +577,8 @@ bool Chain::deformChain(std::pair<Cell*, int> cell, bool bend){
   return false;
 }
 
-void Chain::smoothenChain(){
+void Chain::smoothenChain()
+{
   if(!_cellComplex->simplicial()) return;
   
   int start = getSize();
@@ -616,8 +612,8 @@ void Chain::smoothenChain(){
 }
 
 
-int Chain::writeChainMSH(const std::string &name){
-  
+int Chain::writeChainMSH(const std::string &name)
+{  
   if(getSize() == 0) return 1;
   
   FILE *fp = fopen(name.c_str(), "a");
@@ -651,8 +647,8 @@ int Chain::writeChainMSH(const std::string &name){
   return 1;
 }
 
-void Chain::createPView(){
-  
+void Chain::createPView()
+{  
   std::vector<MElement*> elements;
   std::map<int, std::vector<double> > data;
   
@@ -712,7 +708,8 @@ void Chain::createPView(){
 }
 
 
-void Chain::removeCell(Cell* cell) {
+void Chain::removeCell(Cell* cell) 
+{
   citer it = _cells.find(cell);
   if(it != _cells.end()){
     (*it).second = 0;
@@ -720,7 +717,8 @@ void Chain::removeCell(Cell* cell) {
   return;
 }
 
-void Chain::addCell(Cell* cell, int coeff) {
+void Chain::addCell(Cell* cell, int coeff) 
+{
   std::pair<citer,bool> insert = _cells.insert( std::make_pair( cell, coeff));
   if(!insert.second && (*insert.first).second == 0){
     (*insert.first).second = coeff; 
@@ -731,42 +729,41 @@ void Chain::addCell(Cell* cell, int coeff) {
   return;
 }
 
-bool Chain::hasCell(Cell* c){
+bool Chain::hasCell(Cell* c)
+{
   citer it = _cells.find(c);
   if(it != _cells.end() && (*it).second != 0) return true;
   return false;
-}   
-Cell* Chain::findCell(Cell* c){
+}
+   
+Cell* Chain::findCell(Cell* c)
+{
   citer it = _cells.find(c);
   if(it != _cells.end() && (*it).second != 0) return (*it).first;
   return NULL;
 }
-int Chain::getCoeff(Cell* c){
+
+int Chain::getCoeff(Cell* c)
+{
   citer it = _cells.find(c);
   if(it != _cells.end()) return (*it).second;
   return 0;
 }
 
-void Chain::eraseNullCells(){
-  for(citer cit = _cells.begin(); cit != _cells.end(); cit++){
-    if( (*cit).second == 0){
-      //cit++;
-      //_cells.erase(--cit);
-      _cells.erase(cit);
-      ++cit;
+void Chain::eraseNullCells()
+{
+  std::vector<Cell*> toRemove;
+  for(int i = 0; i < 4; i++){
+    for(citer cit = _cells.begin(); cit != _cells.end(); ++cit){
+      if((*cit).second == 0) toRemove.push_back((*cit).first);
     }
   }
-  for(citer cit = _cells.begin(); cit != _cells.end(); cit++){
-    if( (*cit).second == 0){
-      _cells.erase(cit);
-      cit = _cells.begin(); 
-    }
-     }  
+  for(unsigned int i = 0; i < toRemove.size(); i++) _cells.erase(toRemove[i]);
   return;
 }
 
-
-void Chain::deImmuneCells(){
+void Chain::deImmuneCells()
+{
   for(citer cit = _cells.begin(); cit != _cells.end(); cit++){
     Cell* cell = (*cit).first;
     cell->setImmune(false);
diff --git a/Geo/ChainComplex.h b/Geo/ChainComplex.h
index 6ecb04e7b36843a3959088adfa9f3f13c631d6d5..d57531bba2eb406f968858a86735a84176b69f92 100644
--- a/Geo/ChainComplex.h
+++ b/Geo/ChainComplex.h
@@ -181,7 +181,7 @@ class Chain{
   
   
  public:
-  Chain(){}
+  Chain() {}
   Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, 
 	CellComplex* cellComplex, GModel* model,
 	std::string name="Chain", int torsion=0);
@@ -193,7 +193,7 @@ class Chain{
     _dim = chain->getDim();
     _model = chain->getGModel();
   }
-  ~Chain(){}
+  ~Chain() {}
    
   typedef std::map<Cell*, int, Less_Cell>::iterator citer;
    
@@ -208,11 +208,11 @@ class Chain{
   int getCoeff(Cell* c);
   
   
-  int getTorsion() {return _torsion;}
-  int getDim() {return _dim;}
-  CellComplex* getCellComplex() {return _cellComplex;}
-  GModel* getGModel() {return _model;}
-  std::map<Cell*, int, Less_Cell>  getCells() {return _cells;}
+  int getTorsion() { return _torsion; }
+  int getDim() { return _dim; }
+  CellComplex* getCellComplex() { return _cellComplex; }
+  GModel* getGModel() { return _model; }
+  std::map<Cell*, int, Less_Cell>  getCells() { return _cells; }
   
   // erase cells from the chain with zero coefficient
   void eraseNullCells();
diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp
index 5500a91fea0621fadb9197e92334c2b762353b4f..e8f39cd4b6fa7edb32d21532b64a96f568beeaef 100644
--- a/Geo/Homology.cpp
+++ b/Geo/Homology.cpp
@@ -136,12 +136,12 @@ void Homology::findGenerators(std::string fileName)
 			       chains->getCoeffVector(j,i), 
 			       _cellComplex, _model, name, 
 			       chains->getTorsion(j,i));
-      /*t1 = Cpu();
+      t1 = Cpu();
       int start = chain->getSize();
       chain->smoothenChain();
       t2 = Cpu();
       Msg::Info("Smoothened H%d %d from %d cells to %d cells (%g s).", 
-      j, i, start, chain->getSize(), t2 - t1);*/
+		j, i, start, chain->getSize(), t2 - t1);
       if(chain->getSize() != 0) {
         HRank[j] = HRank[j] + 1;
         if(chain->getTorsion() != 1){
diff --git a/tutorial/t10.geo b/tutorial/t10.geo
index b80d7b1218e2f8c90a9c2a31336dd98be5fd2d4f..16d061d1bded8a13cf448169c729b8aef9e7830e 100644
--- a/tutorial/t10.geo
+++ b/tutorial/t10.geo
@@ -14,7 +14,7 @@
 // Create an example geometry
 
 m=0.5; // mesh characteristic length
-h=1;
+h=2;
 
 Point(newp) = {0, 0, 0, m};
 Point(newp) = {10, 0, 0, m};