Index: factory/facFqBivar.h
===================================================================
--- factory/facFqBivar.h	(revision 3c702a55c31c1f89d836ffcd2577adc61b368074)
+++ factory/facFqBivar.h	(revision a60b8bed450e0ed0680beff9febf2b8c0daf5140)
@@ -49,14 +49,7 @@
             );
 
-/// factorize a squarefree bivariate polynomial over \f$ F_{p} \f$.
-///
-/// @return @a FpBiSqrfFactorize returns a list of monic factors, the first
-///         element is the leading coefficient.
-/// @sa FqBiSqrfFactorize(), GFBiSqrfFactorize()
-inline
-CFList FpBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly
-                         )
+inline CFList
+biSqrfFactorizeHelper (const CanonicalForm& G, ExtensionInfo& info)
 {
-  ExtensionInfo info= ExtensionInfo (false);
   CFMap N;
   CanonicalForm F= compress (G, N);
@@ -65,6 +58,25 @@
   F /= (contentX*contentY);
   CFFList contentXFactors, contentYFactors;
-  contentXFactors= factorize (contentX);
-  contentYFactors= factorize (contentY);
+  if (info.getAlpha().level() != 1)
+  {
+    contentXFactors= factorize (contentX, info.getAlpha());
+    contentYFactors= factorize (contentY, info.getAlpha());
+  }
+  else if (info.getAlpha().level() == 1 && info.getGFDegree() == 1)
+  {
+    contentXFactors= factorize (contentX);
+    contentYFactors= factorize (contentY);
+  }
+  else if (info.getAlpha().level() == 1 && info.getGFDegree() != 1)
+  {
+    CFList bufContentX, bufContentY;
+    bufContentX= biFactorize (contentX, info);
+    bufContentY= biFactorize (contentY, info);
+    for (CFListIterator iter= bufContentX; iter.hasItem(); iter++)
+      contentXFactors.append (CFFactor (iter.getItem(), 1));
+    for (CFListIterator iter= bufContentY; iter.hasItem(); iter++)
+      contentYFactors.append (CFFactor (iter.getItem(), 1));
+  }
+
   if (contentXFactors.getFirst().factor().inCoeffDomain())
     contentXFactors.removeFirst();
@@ -97,4 +109,17 @@
 }
 
+/// factorize a squarefree bivariate polynomial over \f$ F_{p} \f$.
+///
+/// @return @a FpBiSqrfFactorize returns a list of monic factors, the first
+///         element is the leading coefficient.
+/// @sa FqBiSqrfFactorize(), GFBiSqrfFactorize()
+inline
+CFList FpBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly
+                         )
+{
+  ExtensionInfo info= ExtensionInfo (false);
+  return biSqrfFactorizeHelper (G, info);
+}
+
 /// factorize a squarefree bivariate polynomial over \f$ F_{p}(\alpha ) \f$.
 ///
@@ -108,40 +133,5 @@
 {
   ExtensionInfo info= ExtensionInfo (alpha, false);
-  CFMap N;
-  CanonicalForm F= compress (G, N);
-  CanonicalForm contentX= content (F, 1);
-  CanonicalForm contentY= content (F, 2);
-  F /= (contentX*contentY);
-  CFFList contentXFactors, contentYFactors;
-  contentXFactors= factorize (contentX, alpha);
-  contentYFactors= factorize (contentY, alpha);
-  if (contentXFactors.getFirst().factor().inCoeffDomain())
-    contentXFactors.removeFirst();
-  if (contentYFactors.getFirst().factor().inCoeffDomain())
-    contentYFactors.removeFirst();
-  if (F.inCoeffDomain())
-  {
-    CFList result;
-    for (CFFListIterator i= contentXFactors; i.hasItem(); i++)
-      result.append (N (i.getItem().factor()));
-    for (CFFListIterator i= contentYFactors; i.hasItem(); i++)
-      result.append (N (i.getItem().factor()));
-    normalize (result);
-    result.insert (Lc (G));
-    return result;
-  }
-  mat_ZZ M;
-  vec_ZZ S;
-  F= compress (F, M, S);
-  CFList result= biFactorize (F, info);
-  for (CFListIterator i= result; i.hasItem(); i++)
-    i.getItem()= N (decompress (i.getItem(), M, S));
-  for (CFFListIterator i= contentXFactors; i.hasItem(); i++)
-    result.append (N(i.getItem().factor()));
-  for (CFFListIterator i= contentYFactors; i.hasItem(); i++)
-    result.append (N (i.getItem().factor()));
-  normalize (result);
-  result.insert (Lc(G));
-  return result;
+  return biSqrfFactorizeHelper (G, info);
 }
 
@@ -158,40 +148,5 @@
           "GF as base field expected");
   ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false);
-  CFMap N;
-  CanonicalForm F= compress (G, N);
-  CanonicalForm contentX= content (F, 1);
-  CanonicalForm contentY= content (F, 2);
-  F /= (contentX*contentY);
-  CFList contentXFactors, contentYFactors;
-  contentXFactors= biFactorize (contentX, info);
-  contentYFactors= biFactorize (contentY, info);
-  if (contentXFactors.getFirst().inCoeffDomain())
-    contentXFactors.removeFirst();
-  if (contentYFactors.getFirst().inCoeffDomain())
-    contentYFactors.removeFirst();
-  if (F.inCoeffDomain())
-  {
-    CFList result;
-    for (CFListIterator i= contentXFactors; i.hasItem(); i++)
-      result.append (N (i.getItem()));
-    for (CFListIterator i= contentYFactors; i.hasItem(); i++)
-      result.append (N (i.getItem()));
-    normalize (result);
-    result.insert (Lc (G));
-    return result;
-  }
-  mat_ZZ M;
-  vec_ZZ S;
-  F= compress (F, M, S);
-  CFList result= biFactorize (F, info);
-  for (CFListIterator i= result; i.hasItem(); i++)
-    i.getItem()= N (decompress (i.getItem(), M, S));
-  for (CFListIterator i= contentXFactors; i.hasItem(); i++)
-    result.append (N(i.getItem()));
-  for (CFListIterator i= contentYFactors; i.hasItem(); i++)
-    result.append (N (i.getItem()));
-  normalize (result);
-  result.insert (Lc(G));
-  return result;
+  return biSqrfFactorizeHelper (G, info);
 }
 
