Index: factory/facHensel.cc
===================================================================
--- factory/facHensel.cc	(revision c53fdcb0540662085a9f0550fb16457042f01035)
+++ factory/facHensel.cc	(revision 935e8385a885664de6c3ca79f6d8a8373d118f85)
@@ -52,33 +52,15 @@
       convertCF2Fmpz (fmpz_poly_get_coeff_ptr (result, i.exp()*d), i.coeff());
     else
-      for (j=i.coeff(); j.hasTerms(); j++)
-        convertCF2Fmpz (fmpz_poly_get_coeff_ptr (result,i.exp()*d+j.exp()), j.coeff());
+      for (j= i.coeff(); j.hasTerms(); j++)
+        convertCF2Fmpz (fmpz_poly_get_coeff_ptr (result, i.exp()*d+j.exp()),
+                        j.coeff());
   }
   _fmpz_poly_normalise(result);
-
-
-  /*fmpz_t coeff;
-  for (CFIterator i= A; i.hasTerms(); i++)
-  {
-    if (i.coeff().inBaseDomain())
-    {
-      convertCF2Fmpz (coeff, i.coeff());
-      fmpz_poly_set_coeff_fmpz (result, i.exp()*d, coeff);
-    }
-    else
-    {
-      for (CFIterator j= i.coeff();j.hasTerms(); j++)
-      {
-        convertCF2Fmpz (coeff, j.coeff());
-        fmpz_poly_set_coeff_fmpz (result, i.exp()*d+j.exp(), coeff);
-      }
-    }
-  }
-  fmpz_clear (coeff);
-  _fmpz_poly_normalise (result);*/
-}
-
-
-CanonicalForm reverseSubst (const fmpz_poly_t F, int d, const Variable& alpha, const CanonicalForm& den)
+}
+
+
+CanonicalForm
+reverseSubst (const fmpz_poly_t F, int d, const Variable& alpha,
+              const CanonicalForm& den)
 {
   Variable x= Variable (1);
@@ -89,5 +71,5 @@
   int k= 0;
   int degfSubK;
-  int repLength;
+  int repLength, j;
   CanonicalForm coeff;
   fmpz* tmp;
@@ -101,5 +83,5 @@
       repLength= degfSubK + 1;
 
-    for (int j= 0; j < repLength; j++)
+    for (j= 0; j < repLength; j++)
     {
       tmp= fmpz_poly_get_coeff_ptr (F, j+k);
@@ -117,5 +99,7 @@
 }
 
-CanonicalForm mulFLINTQa (const CanonicalForm& F, const CanonicalForm& G, const Variable& alpha)
+CanonicalForm
+mulFLINTQa (const CanonicalForm& F, const CanonicalForm& G,
+            const Variable& alpha)
 {
   CanonicalForm A= F;
@@ -171,5 +155,5 @@
 }
 
-CanonicalForm
+/*CanonicalForm
 mulFLINTQ2 (const CanonicalForm& F, const CanonicalForm& G)
 {
@@ -186,5 +170,5 @@
   fmpq_poly_clear (FLINTB);
   return A;
-}
+}*/
 
 CanonicalForm
@@ -225,5 +209,6 @@
 
 CanonicalForm
-mulFLINTQaTrunc (const CanonicalForm& F, const CanonicalForm& G, const Variable& alpha, int m)
+mulFLINTQaTrunc (const CanonicalForm& F, const CanonicalForm& G,
+                 const Variable& alpha, int m)
 {
   CanonicalForm A= F;
@@ -561,5 +546,6 @@
     Variable alpha;
 #ifdef HAVE_FLINT
-    if ((!F.inCoeffDomain() && !G.inCoeffDomain()) && (hasFirstAlgVar (F, alpha) || hasFirstAlgVar (G, alpha)))
+    if ((!F.inCoeffDomain() && !G.inCoeffDomain()) &&
+        (hasFirstAlgVar (F, alpha) || hasFirstAlgVar (G, alpha)))
     {
       CanonicalForm result= mulFLINTQa (F, G, alpha);
@@ -624,4 +610,5 @@
       return modFLINTQ (F, G);
     else
+      //TODO newtonDivrem
      return mod (F, G);
 #else
@@ -683,4 +670,5 @@
       return divFLINTQ (F,G);
     else
+      //TODO newtonDivrem
       return div (F, G);
 #else
@@ -798,11 +786,12 @@
   nmod_poly_t buf;
 
+  int j, k, bufRepLength;
   for (CFIterator i= A; i.hasTerms(); i++)
   {
     convertFacCF2nmod_poly_t (buf, i.coeff());
 
-    int k= i.exp()*d;
-    int bufRepLength= (int) nmod_poly_length (buf);
-    for (int j= 0; j < bufRepLength; j++)
+    k= i.exp()*d;
+    bufRepLength= (int) nmod_poly_length (buf);
+    for (j= 0; j < bufRepLength; j++)
       nmod_poly_set_coeff_ui (result, j + k, nmod_poly_get_coeff_ui (buf, j));
     nmod_poly_clear (buf);
@@ -895,4 +884,5 @@
   zz_pX buf;
   zz_p *bufp;
+  int j, k, bufRepLength;
 
   for (CFIterator i= A; i.hasTerms(); i++)
@@ -903,8 +893,8 @@
       buf= convertFacCF2NTLzzpX (i.coeff());
 
-    int k= i.exp()*d;
+    k= i.exp()*d;
     bufp= buf.rep.elts();
-    int bufRepLength= (int) buf.rep.length();
-    for (int j= 0; j < bufRepLength; j++)
+    bufRepLength= (int) buf.rep.length();
+    for (j= 0; j < bufRepLength; j++)
       resultp [j + k]= bufp [j];
   }
@@ -927,4 +917,5 @@
   zz_pX buf2;
   zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
+  int j, k, buf1RepLength;
 
   for (CFIterator i= A; i.hasTerms(); i++)
@@ -938,8 +929,8 @@
       buf1= convertFacCF2NTLzz_pEX (i.coeff(), NTLMipo);
 
-    int k= i.exp()*d;
+    k= i.exp()*d;
     buf1p= buf1.rep.elts();
-    int buf1RepLength= (int) buf1.rep.length();
-    for (int j= 0; j < buf1RepLength; j++)
+    buf1RepLength= (int) buf1.rep.length();
+    for (j= 0; j < buf1RepLength; j++)
       resultp [j + k]= buf1p [j];
   }
@@ -966,4 +957,5 @@
   zz_pX buf2;
   zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
+  int j, k, kk, bufRepLength;
 
   for (CFIterator i= A; i.hasTerms(); i++)
@@ -977,9 +969,9 @@
       buf= convertFacCF2NTLzz_pEX (i.coeff(), NTLMipo);
 
-    int k= i.exp()*d;
-    int kk= (degAy - i.exp())*d;
+    k= i.exp()*d;
+    kk= (degAy - i.exp())*d;
     bufp= buf.rep.elts();
-    int bufRepLength= (int) buf.rep.length();
-    for (int j= 0; j < bufRepLength; j++)
+    bufRepLength= (int) buf.rep.length();
+    for (j= 0; j < bufRepLength; j++)
     {
       subA1p [j + k] += bufp [j];
@@ -1004,4 +996,5 @@
   zz_pX buf;
   zz_p *bufp;
+  int j, k, kk, bufRepLength;
 
   for (CFIterator i= A; i.hasTerms(); i++)
@@ -1009,9 +1002,9 @@
     buf= convertFacCF2NTLzzpX (i.coeff());
 
-    int k= i.exp()*d;
-    int kk= (degAy - i.exp())*d;
+    k= i.exp()*d;
+    kk= (degAy - i.exp())*d;
     bufp= buf.rep.elts();
-    int bufRepLength= (int) buf.rep.length();
-    for (int j= 0; j < bufRepLength; j++)
+    bufRepLength= (int) buf.rep.length();
+    for (j= 0; j < bufRepLength; j++)
     {
       subA1p [j + k] += bufp [j];
@@ -1053,6 +1046,5 @@
   int degfSubLf= degf;
   int deggSubLg= degg-lg;
-  int repLengthBuf2;
-  int repLengthBuf1;
+  int repLengthBuf2, repLengthBuf1, ind, tmp;
   zz_pE zzpEZero= zz_pE();
 
@@ -1068,5 +1060,5 @@
 
     buf1p= buf1.rep.elts();
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
       buf1p [ind]= fp [ind + lf];
     buf1.normalize();
@@ -1083,8 +1075,6 @@
     buf2.rep.SetLength ((long) repLengthBuf2);
     buf2p= buf2.rep.elts();
-    for (int ind= 0; ind < repLengthBuf2; ind++)
-    {
+    for (ind= 0; ind < repLengthBuf2; ind++)
       buf2p [ind]= gp [ind + lg];
-    }
     buf2.normalize();
 
@@ -1095,9 +1085,9 @@
     buf2p= buf2.rep.elts();
     buf1p= buf1.rep.elts();
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
       buf3p [ind]= buf1p [ind];
-    for (int ind= repLengthBuf1; ind < d; ind++)
+    for (ind= repLengthBuf1; ind < d; ind++)
       buf3p [ind]= zzpEZero;
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+    for (ind= 0; ind < repLengthBuf2; ind++)
       buf3p [ind + d]= buf2p [ind];
     buf3.normalize();
@@ -1119,6 +1109,6 @@
       if (repLengthBuf2 > degfSubLf + 1)
         degfSubLf= repLengthBuf2 - 1;
-      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
-      for (int ind= 0; ind < tmp; ind++)
+      tmp= tmin (repLengthBuf1, deggSubLg + 1);
+      for (ind= 0; ind < tmp; ind++)
         gp [ind + lg] -= buf1p [ind];
     }
@@ -1130,5 +1120,5 @@
     if (degfSubLf >= 0)
     {
-      for (int ind= 0; ind < repLengthBuf2; ind++)
+      for (ind= 0; ind < repLengthBuf2; ind++)
         fp [ind + lf] -= buf2p [ind];
     }
@@ -1168,6 +1158,5 @@
   int degfSubLf= degf;
   int deggSubLg= degg-lg;
-  int repLengthBuf2;
-  int repLengthBuf1;
+  int repLengthBuf2, repLengthBuf1, ind, tmp;
   zz_p zzpZero= zz_p();
   while (degf >= lf || lg >= 0)
@@ -1182,5 +1171,5 @@
 
     buf1p= buf1.rep.elts();
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
       buf1p [ind]= fp [ind + lf];
     buf1.normalize();
@@ -1197,5 +1186,5 @@
     buf2.rep.SetLength ((long) repLengthBuf2);
     buf2p= buf2.rep.elts();
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+    for (ind= 0; ind < repLengthBuf2; ind++)
       buf2p [ind]= gp [ind + lg];
 
@@ -1209,9 +1198,9 @@
     buf2p= buf2.rep.elts();
     buf1p= buf1.rep.elts();
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
       buf3p [ind]= buf1p [ind];
-    for (int ind= repLengthBuf1; ind < d; ind++)
+    for (ind= repLengthBuf1; ind < d; ind++)
       buf3p [ind]= zzpZero;
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+    for (ind= 0; ind < repLengthBuf2; ind++)
       buf3p [ind + d]= buf2p [ind];
     buf3.normalize();
@@ -1233,6 +1222,6 @@
       if (repLengthBuf2 > degfSubLf + 1)
         degfSubLf= repLengthBuf2 - 1;
-      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
-      for (int ind= 0; ind < tmp; ind++)
+      tmp= tmin (repLengthBuf1, deggSubLg + 1);
+      for (ind= 0; ind < tmp; ind++)
         gp [ind + lg] -= buf1p [ind];
     }
@@ -1243,5 +1232,5 @@
     if (degfSubLf >= 0)
     {
-      for (int ind= 0; ind < repLengthBuf2; ind++)
+      for (ind= 0; ind < repLengthBuf2; ind++)
         fp [ind + lf] -= buf2p [ind];
     }
@@ -1265,6 +1254,5 @@
   int degf= deg(f);
   int k= 0;
-  int degfSubK;
-  int repLength;
+  int degfSubK, repLength, j;
   while (degf >= k)
   {
@@ -1277,5 +1265,5 @@
     buf.rep.SetLength ((long) repLength);
     bufp= buf.rep.elts();
-    for (int j= 0; j < repLength; j++)
+    for (j= 0; j < repLength; j++)
       bufp [j]= fp [j + k];
     buf.normalize();
@@ -1303,6 +1291,5 @@
   int degf= deg(f);
   int k= 0;
-  int degfSubK;
-  int repLength;
+  int degfSubK, repLength, j;
   while (degf >= k)
   {
@@ -1315,5 +1302,5 @@
     buf.rep.SetLength ((long) repLength);
     bufp= buf.rep.elts();
-    for (int j= 0; j < repLength; j++)
+    for (j= 0; j < repLength; j++)
       bufp [j]= fp [j + k];
     buf.normalize();
@@ -1472,5 +1459,6 @@
 #ifdef HAVE_FLINT
 void
-kronSubRecipro (nmod_poly_t subA1, nmod_poly_t subA2, const CanonicalForm& A, int d)
+kronSubRecipro (nmod_poly_t subA1, nmod_poly_t subA2, const CanonicalForm& A,
+                int d)
 {
   int degAy= degree (A);
@@ -1481,15 +1469,26 @@
   nmod_poly_t buf;
 
+  int k, kk, j, bufRepLength;
   for (CFIterator i= A; i.hasTerms(); i++)
   {
     convertFacCF2nmod_poly_t (buf, i.coeff());
 
-    int k= i.exp()*d;
-    int kk= (degAy - i.exp())*d;
-    int bufRepLength= (int) nmod_poly_length (buf);
-    for (int j= 0; j < bufRepLength; j++)
-    {
-      nmod_poly_set_coeff_ui (subA1, j + k, n_addmod (nmod_poly_get_coeff_ui (subA1, j+k), nmod_poly_get_coeff_ui (buf, j), getCharacteristic())); //TODO muÃ man subA1 coeffs von subA1 vorher auf null setzen??
-      nmod_poly_set_coeff_ui (subA2, j + kk, n_addmod (nmod_poly_get_coeff_ui (subA2, j + kk),nmod_poly_get_coeff_ui (buf, j), getCharacteristic()));
+    k= i.exp()*d;
+    kk= (degAy - i.exp())*d;
+    bufRepLength= (int) nmod_poly_length (buf);
+    for (j= 0; j < bufRepLength; j++)
+    {
+      nmod_poly_set_coeff_ui (subA1, j + k,
+                              n_addmod (nmod_poly_get_coeff_ui (subA1, j+k),
+                                        nmod_poly_get_coeff_ui (buf, j),
+                                        getCharacteristic()
+                                       )
+                             );
+      nmod_poly_set_coeff_ui (subA2, j + kk,
+                              n_addmod (nmod_poly_get_coeff_ui (subA2, j + kk),
+                                        nmod_poly_get_coeff_ui (buf, j),
+                                        getCharacteristic()
+                                       )
+                             );
     }
     nmod_poly_clear (buf);
@@ -1500,5 +1499,6 @@
 
 void
-kronSubRecipro (fmpz_poly_t subA1, fmpz_poly_t subA2, const CanonicalForm& A, int d)
+kronSubRecipro (fmpz_poly_t subA1, fmpz_poly_t subA2, const CanonicalForm& A,
+                int d)
 {
   int degAy= degree (A);
@@ -1509,15 +1509,15 @@
   fmpz_t coeff1, coeff2;
 
+  int k, kk, j, bufRepLength;
   for (CFIterator i= A; i.hasTerms(); i++)
   {
     convertFacCF2Fmpz_poly_t (buf, i.coeff());
 
-    int k= i.exp()*d;
-    int kk= (degAy - i.exp())*d;
-    int bufRepLength= (int) fmpz_poly_length (buf);
-    for (int j= 0; j < bufRepLength; j++)
-    {
-      fmpz_poly_get_coeff_fmpz (coeff1, subA1, j+k); //TODO muÃ man subA1 coeffs von subA1 vorher auf null setzen??
-                                                     // vielleicht ist es schneller fmpz_poly_get_ptr zu nehmen
+    k= i.exp()*d;
+    kk= (degAy - i.exp())*d;
+    bufRepLength= (int) fmpz_poly_length (buf);
+    for (j= 0; j < bufRepLength; j++)
+    {
+      fmpz_poly_get_coeff_fmpz (coeff1, subA1, j+k);
       fmpz_poly_get_coeff_fmpz (coeff2, buf, j);
       fmpz_add (coeff1, coeff1, coeff2);
@@ -1549,6 +1549,5 @@
   int degf= fmpz_poly_degree(f);
   int k= 0;
-  int degfSubK;
-  int repLength;
+  int degfSubK, repLength, j;
   fmpz_t coeff;
   while (degf >= k)
@@ -1562,5 +1561,5 @@
     fmpz_poly_init2 (buf, repLength);
     fmpz_init (coeff);
-    for (int j= 0; j < repLength; j++)
+    for (j= 0; j < repLength; j++)
     {
       fmpz_poly_get_coeff_fmpz (coeff, f, j + k);
@@ -1597,7 +1596,4 @@
 
   nmod_poly_t buf1,buf2, buf3;
-  /*nmod_poly_init_preinv (buf1, getCharacteristic(), ninv);
-  nmod_poly_init_preinv (buf2, getCharacteristic(), ninv);
-  nmod_poly_init_preinv (buf3, getCharacteristic(), ninv);*/
 
   if (nmod_poly_length (f) < (long) d*(k+1)) //zero padding
@@ -1610,7 +1606,5 @@
   int degfSubLf= degf;
   int deggSubLg= degg-lg;
-  int repLengthBuf2;
-  int repLengthBuf1;
-  //zz_p zzpZero= zz_p();
+  int repLengthBuf2, repLengthBuf1, ind, tmp;
   while (degf >= lf || lg >= 0)
   {
@@ -1621,13 +1615,9 @@
     else
       repLengthBuf1= degfSubLf + 1;
-    //cout << "repLengthBuf1= " << repLengthBuf1 << "\n";
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
     nmod_poly_init2_preinv (buf1, getCharacteristic(), ninv, repLengthBuf1);
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
-
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+
+    for (ind= 0; ind < repLengthBuf1; ind++)
       nmod_poly_set_coeff_ui (buf1, ind, nmod_poly_get_coeff_ui (f, ind+lf));
     _nmod_poly_normalise (buf1);
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
 
     repLengthBuf1= nmod_poly_length (buf1);
@@ -1640,22 +1630,18 @@
       repLengthBuf2= deggSubLg + 1;
 
-    //cout << "repLengthBuf2= " << repLengthBuf2 << "\n";
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
     nmod_poly_init2_preinv (buf2, getCharacteristic(), ninv, repLengthBuf2);
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+    for (ind= 0; ind < repLengthBuf2; ind++)
       nmod_poly_set_coeff_ui (buf2, ind, nmod_poly_get_coeff_ui (g, ind + lg));
 
     _nmod_poly_normalise (buf2);
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
     repLengthBuf2= nmod_poly_length (buf2);
 
     nmod_poly_init2_preinv (buf3, getCharacteristic(), ninv, repLengthBuf2 + d);
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
       nmod_poly_set_coeff_ui (buf3, ind, nmod_poly_get_coeff_ui (buf1, ind));
-    for (int ind= repLengthBuf1; ind < d; ind++)
+    for (ind= repLengthBuf1; ind < d; ind++)
       nmod_poly_set_coeff_ui (buf3, ind, 0);
-    for (int ind= 0; ind < repLengthBuf2; ind++)
-      nmod_poly_set_coeff_ui (buf3, ind + d, nmod_poly_get_coeff_ui (buf2, ind));
+    for (ind= 0; ind < repLengthBuf2; ind++)
+      nmod_poly_set_coeff_ui (buf3, ind+d, nmod_poly_get_coeff_ui (buf2, ind));
     _nmod_poly_normalise (buf3);
 
@@ -1674,10 +1660,12 @@
       if (repLengthBuf2 > degfSubLf + 1)
         degfSubLf= repLengthBuf2 - 1;
-      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
-      for (int ind= 0; ind < tmp; ind++)
-      //{
-        nmod_poly_set_coeff_ui (g, ind + lg, n_submod (nmod_poly_get_coeff_ui (g, ind + lg), nmod_poly_get_coeff_ui (buf1, ind), getCharacteristic()));
-        //cout << "nmod_poly_get_coeff_ui (g, ind + lg)= " << nmod_poly_get_coeff_ui (g, ind + lg) << "\n";
-      //}
+      tmp= tmin (repLengthBuf1, deggSubLg + 1);
+      for (ind= 0; ind < tmp; ind++)
+        nmod_poly_set_coeff_ui (g, ind + lg,
+                                n_submod (nmod_poly_get_coeff_ui (g, ind + lg),
+                                          nmod_poly_get_coeff_ui (buf1, ind),
+                                          getCharacteristic()
+                                         )
+                               );
     }
     if (lg < 0)
@@ -1690,18 +1678,17 @@
     if (degfSubLf >= 0)
     {
-      for (int ind= 0; ind < repLengthBuf2; ind++)
-        nmod_poly_set_coeff_ui (f, ind + lf, n_submod (nmod_poly_get_coeff_ui (f, ind + lf), nmod_poly_get_coeff_ui (buf2, ind), getCharacteristic()));
+      for (ind= 0; ind < repLengthBuf2; ind++)
+        nmod_poly_set_coeff_ui (f, ind + lf,
+                                n_submod (nmod_poly_get_coeff_ui (f, ind + lf),
+                                          nmod_poly_get_coeff_ui (buf2, ind),
+                                          getCharacteristic()
+                                         )
+                               );
     }
     nmod_poly_clear (buf1);
     nmod_poly_clear (buf2);
     nmod_poly_clear (buf3);
-    /*nmod_poly_init_preinv (buf1, getCharacteristic(), ninv);
-    nmod_poly_init_preinv (buf2, getCharacteristic(), ninv);
-    nmod_poly_init_preinv (buf3, getCharacteristic(), ninv);*/
-  }
-
-  /*nmod_poly_clear (buf1);
-  nmod_poly_clear (buf2);
-  nmod_poly_clear (buf3);*/
+  }
+
   nmod_poly_clear (f);
   nmod_poly_clear (g);
@@ -1726,7 +1713,4 @@
 
   fmpz_poly_t buf1,buf2, buf3;
-  /*nmod_poly_init_preinv (buf1, getCharacteristic(), ninv);
-  nmod_poly_init_preinv (buf2, getCharacteristic(), ninv);
-  nmod_poly_init_preinv (buf3, getCharacteristic(), ninv);*/
 
   if (fmpz_poly_length (f) < (long) d*(k+1)) //zero padding
@@ -1739,7 +1723,5 @@
   int degfSubLf= degf;
   int deggSubLg= degg-lg;
-  int repLengthBuf2;
-  int repLengthBuf1;
-  //zz_p zzpZero= zz_p();
+  int repLengthBuf2, repLengthBuf1, ind, tmp;
   fmpz_t tmp1, tmp2;
   while (degf >= lf || lg >= 0)
@@ -1751,10 +1733,8 @@
     else
       repLengthBuf1= degfSubLf + 1;
-    //cout << "repLengthBuf1= " << repLengthBuf1 << "\n";
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
+
     fmpz_poly_init2 (buf1, repLengthBuf1);
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
-
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+
+    for (ind= 0; ind < repLengthBuf1; ind++)
     {
       fmpz_poly_get_coeff_fmpz (tmp1, f, ind + lf);
@@ -1762,5 +1742,4 @@
     }
     _fmpz_poly_normalise (buf1);
-    //cout << "nmod_poly_length (buf1)= " << nmod_poly_length (buf1) << "\n";
 
     repLengthBuf1= fmpz_poly_length (buf1);
@@ -1773,9 +1752,7 @@
       repLengthBuf2= deggSubLg + 1;
 
-    //cout << "repLengthBuf2= " << repLengthBuf2 << "\n";
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
     fmpz_poly_init2 (buf2, repLengthBuf2);
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+
+    for (ind= 0; ind < repLengthBuf2; ind++)
     {
       fmpz_poly_get_coeff_fmpz (tmp1, g, ind + lg);
@@ -1784,16 +1761,15 @@
 
     _fmpz_poly_normalise (buf2);
-    //cout << "nmod_poly_length (buf2)= " << nmod_poly_length (buf2) << "\n";
     repLengthBuf2= fmpz_poly_length (buf2);
 
     fmpz_poly_init2 (buf3, repLengthBuf2 + d);
-    for (int ind= 0; ind < repLengthBuf1; ind++)
+    for (ind= 0; ind < repLengthBuf1; ind++)
     {
       fmpz_poly_get_coeff_fmpz (tmp1, buf1, ind);  //oder fmpz_set (fmpz_poly_get_coeff_ptr (buf3, ind),fmpz_poly_get_coeff_ptr (buf1, ind))
       fmpz_poly_set_coeff_fmpz (buf3, ind, tmp1);
     }
-    for (int ind= repLengthBuf1; ind < d; ind++)
+    for (ind= repLengthBuf1; ind < d; ind++)
       fmpz_poly_set_coeff_ui (buf3, ind, 0);
-    for (int ind= 0; ind < repLengthBuf2; ind++)
+    for (ind= 0; ind < repLengthBuf2; ind++)
     {
       fmpz_poly_get_coeff_fmpz (tmp1, buf2, ind);
@@ -1816,6 +1792,6 @@
       if (repLengthBuf2 > degfSubLf + 1)
         degfSubLf= repLengthBuf2 - 1;
-      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
-      for (int ind= 0; ind < tmp; ind++)
+      tmp= tmin (repLengthBuf1, deggSubLg + 1);
+      for (ind= 0; ind < tmp; ind++)
       {
         fmpz_poly_get_coeff_fmpz (tmp1, g, ind + lg);
@@ -1823,5 +1799,4 @@
         fmpz_sub (tmp1, tmp1, tmp2);
         fmpz_poly_set_coeff_fmpz (g, ind + lg, tmp1);
-        //cout << "nmod_poly_get_coeff_ui (g, ind + lg)= " << nmod_poly_get_coeff_ui (g, ind + lg) << "\n";
       }
     }
@@ -1835,5 +1810,5 @@
     if (degfSubLf >= 0)
     {
-      for (int ind= 0; ind < repLengthBuf2; ind++)
+      for (ind= 0; ind < repLengthBuf2; ind++)
       {
         fmpz_poly_get_coeff_fmpz (tmp1, f, ind + lf);
@@ -1846,12 +1821,6 @@
     fmpz_poly_clear (buf2);
     fmpz_poly_clear (buf3);
-    /*nmod_poly_init_preinv (buf1, getCharacteristic(), ninv);
-    nmod_poly_init_preinv (buf2, getCharacteristic(), ninv);
-    nmod_poly_init_preinv (buf3, getCharacteristic(), ninv);*/
-  }
-
-  /*nmod_poly_clear (buf1);
-  nmod_poly_clear (buf2);
-  nmod_poly_clear (buf3);*/
+  }
+
   fmpz_poly_clear (f);
   fmpz_poly_clear (g);
@@ -1873,11 +1842,9 @@
 
   nmod_poly_t buf;
-  //nmod_poly_init_preinv (buf, getCharacteristic(), ninv);
   CanonicalForm result= 0;
   int i= 0;
   int degf= nmod_poly_degree(f);
   int k= 0;
-  int degfSubK;
-  int repLength;
+  int degfSubK, repLength, j;
   while (degf >= k)
   {
@@ -1889,9 +1856,7 @@
 
     nmod_poly_init2_preinv (buf, getCharacteristic(), ninv, repLength);
-    for (int j= 0; j < repLength; j++)
+    for (j= 0; j < repLength; j++)
       nmod_poly_set_coeff_ui (buf, j, nmod_poly_get_coeff_ui (f, j + k));
-    //printf ("after set\n");
     _nmod_poly_normalise (buf);
-    //printf ("after normalise\n");
 
     result += convertnmod_poly_t2FacCF (buf, x)*power (y, i);
@@ -1899,10 +1864,6 @@
     k= d*i;
     nmod_poly_clear (buf);
-    //nmod_poly_init_preinv (buf, getCharacteristic(), ninv);
-  }
-  //printf ("after while\n");
-  //nmod_poly_clear (buf);
+  }
   nmod_poly_clear (f);
-  //printf ("after clear\n");
 
   return result;
@@ -1922,9 +1883,4 @@
   nmod_poly_init_preinv (F2, getCharacteristic(), ninv);
   kronSubRecipro (F1, F2, F, d1);
-  /*zz_pX TF1, TF2;
-  kronSubRecipro (TF1, TF2, F, d1);
-  Variable x= Variable (1);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF1, x) == convertnmod_poly_t2FacCF (F1, x)) << "\n";
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF2, x) == convertnmod_poly_t2FacCF (F2, x)) << "\n";*/
 
   nmod_poly_t G1, G2;
@@ -1932,14 +1888,7 @@
   nmod_poly_init_preinv (G2, getCharacteristic(), ninv);
   kronSubRecipro (G1, G2, G, d1);
-  /*zz_pX TG1, TG2;
-  kronSubRecipro (TG1, TG2, G, d1);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TG1, x) == convertnmod_poly_t2FacCF (G1, x)) << "\n";
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TG2, x) == convertnmod_poly_t2FacCF (G2, x)) << "\n";*/
-
 
   int k= d1*degree (M);
   nmod_poly_mullow (F1, F1, G1, (long) k);
-  /*MulTrunc (TF1, TF1, TG1, (long) k);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF1, x) == convertnmod_poly_t2FacCF (F1, x)) << "\n";*/
 
   int degtailF= degree (tailcoeff (F), 1);;
@@ -1948,20 +1897,12 @@
   int taildegG= taildegree (G);
 
-  int b= nmod_poly_degree (F2) + nmod_poly_degree (G2) - k - degtailF - degtailG + d1*(2+taildegF + taildegG);
+  int b= nmod_poly_degree (F2) + nmod_poly_degree (G2) - k - degtailF - degtailG
+         + d1*(2+taildegF + taildegG);
   nmod_poly_mulhigh (F2, F2, G2, b);
   nmod_poly_shift_right (F2, F2, b);
-  /*mul (TF2, TF2, TG2);
-  if (deg (TF2) > k)
-  {
-    int b= deg (TF2) - k + 2;
-    TF2 >>= b;
-  }
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF2, x) == convertnmod_poly_t2FacCF (F2, x)) << "\n";*/
   int d2= tmax (nmod_poly_degree (F2)/d1, nmod_poly_degree (F1)/d1);
 
 
   CanonicalForm result= reverseSubst (F1, F2, d1, d2);
-  //CanonicalForm NTLres= reverseSubst (TF1, TF2, d1, d2);
-  //cout << "FINALtestkronSubReci= " << (NTLres == result) << "\n";
 
   nmod_poly_clear (F1);
@@ -2018,9 +1959,4 @@
   fmpz_poly_init (F2);
   kronSubRecipro (F1, F2, F, d1);
-  /*zz_pX TF1, TF2;
-  kronSubRecipro (TF1, TF2, F, d1);
-  Variable x= Variable (1);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF1, x) == convertnmod_poly_t2FacCF (F1, x)) << "\n";
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF2, x) == convertnmod_poly_t2FacCF (F2, x)) << "\n";*/
 
   fmpz_poly_t G1, G2;
@@ -2028,14 +1964,7 @@
   fmpz_poly_init (G2);
   kronSubRecipro (G1, G2, G, d1);
-  /*zz_pX TG1, TG2;
-  kronSubRecipro (TG1, TG2, G, d1);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TG1, x) == convertnmod_poly_t2FacCF (G1, x)) << "\n";
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TG2, x) == convertnmod_poly_t2FacCF (G2, x)) << "\n";*/
-
 
   int k= d1*degree (M);
   fmpz_poly_mullow (F1, F1, G1, (long) k);
-  /*MulTrunc (TF1, TF1, TG1, (long) k);
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF1, x) == convertnmod_poly_t2FacCF (F1, x)) << "\n";*/
 
   int degtailF= degree (tailcoeff (F), 1);;
@@ -2044,21 +1973,11 @@
   int taildegG= taildegree (G);
 
-  int b= fmpz_poly_degree (F2) + fmpz_poly_degree (G2) - k - degtailF - degtailG + d1*(2+taildegF + taildegG);
+  int b= fmpz_poly_degree (F2) + fmpz_poly_degree (G2) - k - degtailF - degtailG
+         + d1*(2+taildegF + taildegG);
   fmpz_poly_mulhigh_n (F2, F2, G2, b);
   fmpz_poly_shift_right (F2, F2, b);
-  /*mul (TF2, TF2, TG2);
-  if (deg (TF2) > k)
-  {
-    int b= deg (TF2) - k + 2;
-    TF2 >>= b;
-  }
-  cout << "testkronSubReci= " << (convertNTLzzpX2CF (TF2, x) == convertnmod_poly_t2FacCF (F2, x)) << "\n";*/
   int d2= tmax (fmpz_poly_degree (F2)/d1, fmpz_poly_degree (F1)/d1);
 
-
   CanonicalForm result= reverseSubst (F1, F2, d1, d2);
-
-  //CanonicalForm NTLres= reverseSubst (TF1, TF2, d1, d2);
-  //cout << "FINALtestkronSubReci= " << (NTLres == result) << "\n";
 
   fmpz_poly_clear (F1);
@@ -2077,9 +1996,6 @@
 
   int degAx= degree (A, 1);
-  //int degAy= degree (A, 2);
   int degBx= degree (B, 1);
-  //int degBy= degree (B, 2);
   int d1= degAx + 1 + degBx;
-  //int d2= tmax (degAy, degBy);
 
   CanonicalForm f= bCommonDen (F);
