Index: pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage
===================================================================
--- pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage	(revision 122)
+++ pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage	(revision 123)
@@ -181,6 +181,7 @@
     protoMatrixRows = []
     polynomialsList = []
     pVariables = p.variables()
+    #print "In spo...", p, p.variables()
     iVariable = pVariables[0]
     tVariable = pVariables[1]
     polynomialAtPower = pRing(1)
Index: pobysoPythonSage/src/sageSLZ/sageSLZ.sage
===================================================================
--- pobysoPythonSage/src/sageSLZ/sageSLZ.sage	(revision 122)
+++ pobysoPythonSage/src/sageSLZ/sageSLZ.sage	(revision 123)
@@ -169,15 +169,95 @@
     return (lb, ub)
 # End slz_compute_binade_bounds
 #
+def slz_compute_coppersmith_reduced_polynomials(inputPolynomial,
+                                                 alpha,
+                                                 N,
+                                                 iBound,
+                                                 tBound):
+    """
+    For a given set of arguments (see below), compute a list
+    of "reduced polynomials" that could be used to compute roots
+    of the inputPolynomial.
+    """
+    # Arguments check.
+    if iBound == 0 or tBound == 0:
+        return ()
+    # End arguments check.
+    nAtAlpha = N^alpha
+    ## Building polynomials for matrix.
+    polyRing   = inputPolynomial.parent()
+    # Whatever the 2 variables are actually called, we call them
+    # 'i' and 't' in all the variable names.
+    (iVariable, tVariable) = inputPolynomial.variables()[:2]
+    #print polyVars[0], type(polyVars[0])
+    initialPolynomial = inputPolynomial.subs({iVariable:iVariable * iBound,
+                                              tVariable:tVariable * tBound})
+    polynomialsList = \
+        spo_polynomial_to_polynomials_list_5(initialPolynomial,
+                                             alpha,
+                                             N,
+                                             iBound,
+                                             tBound,
+                                             0)
+    #print "Polynomials list:", polynomialsList
+    ## Building the proto matrix.
+    knownMonomials = []
+    protoMatrix    = []
+    for poly in polynomialsList:
+        spo_add_polynomial_coeffs_to_matrix_row(poly,
+                                                knownMonomials,
+                                                protoMatrix,
+                                                0)
+    matrixToReduce = spo_proto_to_row_matrix(protoMatrix)
+    #print matrixToReduce
+    ## Reduction and checking.
+    reducedMatrix = matrixToReduce.LLL(fp='fp')
+    isLLLReduced  = reducedMatrix.is_LLL_reduced()
+    if not isLLLReduced:
+        return ()
+    monomialsCount     = len(knownMonomials)
+    monomialsCountSqrt = sqrt(monomialsCount)
+    #print "Monomials count:", monomialsCount, monomialsCountSqrt.n()
+    #print reducedMatrix
+    ## Check the Coppersmith condition for each row and build the reduced 
+    #  polynomials.
+    ccReducedPolynomialsList = []
+    for row in reducedMatrix.rows():
+        l2Norm = row.norm(2)
+        if (l2Norm * monomialsCountSqrt) < nAtAlpha:
+            #print (l2Norm * monomialsCountSqrt).n()
+            print l2Norm.n()
+            ccReducedPolynomial = \
+                slz_compute_reduced_polynomial(row,
+                                               knownMonomials,
+                                               iVariable,
+                                               iBound,
+                                               tVariable,
+                                               tBound)
+            if not ccReducedPolynomial is None:
+                ccReducedPolynomialsList.append(ccReducedPolynomial)
+        else:
+            print l2Norm.n() , ">", nAtAlpha
+            pass
+    if len(ccReducedPolynomialsList) < 2:
+        print "***Less than 2 Coppersmith condition compliant vectors.***"
+        return ()
+    return ccReducedPolynomialsList
+# End slz_compute_coppersmith_reduced_polynomials
+
 def slz_compute_integer_polynomial_modular_roots(inputPolynomial,
                                                  alpha,
                                                  N,
                                                  iBound,
                                                  tBound):
     """
-    For a given set of arguments (see below) , compute the polynomial modular 
+    For a given set of arguments (see below), compute the polynomial modular 
     roots, if any.
     """
+    # Arguments check.
+    if iBound == 0 or tBound == 0:
+        return set()
+    # End arguments check.
     nAtAlpha = N^alpha
     ## Building polynomials for matrix.
     polyRing   = inputPolynomial.parent()
@@ -193,8 +273,8 @@
                                              N,
                                              iBound,
                                              tBound,
-                                             10)
-    print "Polynomials list:", polynomialsList
+                                             0)
+    #print "Polynomials list:", polynomialsList
     ## Building the proto matrix.
     knownMonomials = []
     protoMatrix    = []
@@ -209,16 +289,19 @@
     reducedMatrix = matrixToReduce.LLL(fp='fp')
     isLLLReduced  = reducedMatrix.is_LLL_reduced()
     if not isLLLReduced:
-        return None
+        return set()
     monomialsCount     = len(knownMonomials)
     monomialsCountSqrt = sqrt(monomialsCount)
+    #print "Monomials count:", monomialsCount, monomialsCountSqrt.n()
+    #print reducedMatrix
     ## Check the Coppersmith condition for each row and build the reduced 
     #  polynomials.
     ccReducedPolynomialsList = []
     for row in reducedMatrix.rows():
         l2Norm = row.norm(2)
-        if (l2Norm * monomialsCountSqrt < nAtAlpha):
-            print (l2Norm * monomialsCountSqrt).n()
+        if (l2Norm * monomialsCountSqrt) < nAtAlpha:
+            #print (l2Norm * monomialsCountSqrt).n()
+            #print l2Norm.n()
             ccReducedPolynomial = \
                 slz_compute_reduced_polynomial(row,
                                                knownMonomials,
@@ -228,9 +311,13 @@
                                                tBound)
             if not ccReducedPolynomial is None:
                 ccReducedPolynomialsList.append(ccReducedPolynomial)
+        else:
+            #print l2Norm.n() , ">", nAtAlpha
+            pass
     if len(ccReducedPolynomialsList) < 2:
         print "Less than 2 Coppersmith condition compliant vectors."
-        return None
+        return set()
+    #print ccReducedPolynomialsList
     ## Create the valid (poly1 and poly2 are algebraically independent) 
     # resultant tuples (poly1, poly2, resultant(poly1, poly2)).
     # Try to mix and match all the polynomial pairs built from the 
@@ -244,7 +331,6 @@
             resultantInI = \
                ccReducedPolynomialsList[polyOuterIndex].resultant(ccReducedPolynomialsList[polyInnerIndex],
                                                                   ccReducedPolynomialsList[0].parent(str(iVariable)))
-            #print resultantInI
             #print "Resultant", resultantInI
             # Test algebraic independence.
             if not resultantInI.is_zero():
@@ -254,7 +340,8 @@
     # If no non zero resultant was found: we can't get no algebraically 
     # independent polynomials pair. Give up!
     if len(resultantsInITuplesList) == 0:
-        return None
+        return set()
+    #print resultantsInITuplesList
     # Compute the roots.
     Zi = ZZ[str(iVariable)]
     Zt = ZZ[str(tVariable)]
@@ -264,12 +351,13 @@
     for resultantInITuple in resultantsInITuplesList:
         tRootsList = Zt(resultantInITuple[2]).roots()
         # For each tRoot, compute the corresponding iRoots and check 
-        # them in the polynomial.
+        # them in the input polynomial.
         for tRoot in tRootsList:
-            print "tRoot:", tRoot
+            #print "tRoot:", tRoot
             # Roots returned by root() are (value, multiplicity) tuples.
             iRootsList = \
                 Zi(resultantInITuple[0].subs({resultantInITuple[0].variables()[1]:tRoot[0]})).roots()
+            print iRootsList
             # The iRootsList can be empty, hence the test.
             if len(iRootsList) != 0:
                 for iRoot in iRootsList:
@@ -378,6 +466,7 @@
     ## Initialisations. 
     polynomialRing = knownMonomials[0].parent() 
     currentPolynomial = polynomialRing(0)
+    # TODO: use zip instead of indices.
     for colIndex in xrange(0, len(knownMonomials)):
         currentCoefficient = matrixRow[colIndex]
         if currentCoefficient != 0:
@@ -386,17 +475,17 @@
             #print "Monomial as multivariate polynomial:", \
             #currentMonomial, type(currentMonomial)
             degreeInVar1 = currentMonomial.degree(var1)
-            #print "Degree in var", var1, ":", degreeInVar1
+            #print "Degree in var1", var1, ":", degreeInVar1
             degreeInVar2 = currentMonomial.degree(var2)
-            #print "Degree in var", var2, ":", degreeInVar2
+            #print "Degree in var2", var2, ":", degreeInVar2
             if degreeInVar1 > 0:
                 currentCoefficient = \
-                    currentCoefficient / var1Bound^degreeInVar1
+                    currentCoefficient / (var1Bound^degreeInVar1)
                 #print "varBound1 in degree:", var1Bound^degreeInVar1
                 #print "Current coefficient(1)", currentCoefficient
             if degreeInVar2 > 0:
                 currentCoefficient = \
-                    currentCoefficient / var2Bound^degreeInVar2
+                    currentCoefficient / (var2Bound^degreeInVar2)
                 #print "Current coefficient(2)", currentCoefficient
             #print "Current reduced monomial:", (currentCoefficient * \
             #                                    currentMonomial)
