Index: libpolys/coeffs/numbers.h
===================================================================
--- libpolys/coeffs/numbers.h	(revision b27c0524d725542db31ecb0c95c603a31a1d1faa)
+++ libpolys/coeffs/numbers.h	(revision f70f641abd84405ed069738ba8c3597d64be24dc)
@@ -72,4 +72,6 @@
 /// Test whether a is a zero divisor in r
 /// i.e. not coprime with char. of r
+/// very inefficient implementation:
+/// should ONLY be used for debug stuff /tests
 BOOLEAN n_IsZeroDivisor( number a, const coeffs r);
 
Index: libpolys/polys/monomials/ring.cc
===================================================================
--- libpolys/polys/monomials/ring.cc	(revision b27c0524d725542db31ecb0c95c603a31a1d1faa)
+++ libpolys/polys/monomials/ring.cc	(revision f70f641abd84405ed069738ba8c3597d64be24dc)
@@ -171,5 +171,5 @@
 }
 ring   rDefault(coeffs cf, int N, char **n)
-{  
+{
   assume( cf != NULL);
   /*order: lp,0*/
@@ -314,5 +314,5 @@
     }
   }
-#endif  
+#endif
   Print("//   number of vars : %d",r->N);
 
@@ -420,5 +420,5 @@
 //          iiWriteMatrix((matrix)Q,"scaQ",1);
 //        }
-//        else 
+//        else
             PrintS(" ...");
       }
@@ -739,5 +739,5 @@
 {
   TODO(Somabody, move this proc. over to coeffs!?);
-  
+
 #ifdef HAVE_RINGS
   if (rField_is_Ring_2toM(r))
@@ -748,5 +748,5 @@
     return binaryPower((int)mpz_get_ui(r->cf->modBase),
                        (int)(unsigned long)r->cf->modExponent);
-  
+
 #endif
   if (rField_is_numeric(r))
@@ -776,5 +776,5 @@
 {
   r = rCopy(r);
-  if (rIsPluralRing(r)) 
+  if (rIsPluralRing(r))
     return r;
 
@@ -815,115 +815,39 @@
   else /* different type */
   {
-    if (r1->cf->ch<-1) /* Z/p(a) */
-    {
-      if ((r2->cf->ch==0) /* Q */
-          || (r2->cf->ch==-r1->cf->ch)) /* Z/p */
-      {
-        tmpR.cf->ch=r1->cf->ch;
-        tmpR.cf->P=rPar(r1);
-        tmpR.cf->parameter=(char **)omAlloc(rPar(r1)*sizeof(char *));
-        int i;
-        for (i=0;i<rPar(r1);i++)
-        {
-          tmpR.cf->parameter[i]=omStrDup(r1->cf->parameter[i]);
-        }
-        if (r1->cf->minpoly!=NULL)
-        {
-          tmpR.cf->minpoly=n_Copy(r1->cf->minpoly, r1->cf);
-        }
-      }
-      else  /* R, Q(a),Z/q,Z/p(a),GF(p,n) */
-      {
-        WerrorS("Z/p(a)+(R,Q(a),Z/q(a),GF(q,n))");
+    if (getCoeffType(r1->cf)==n_Zp)
+    {
+      if (getCoeffType(r2->cf)==n_Q)
+      {
+        tmpR.cf=r1->cf;
+        r1->cf->ref++;
+      }
+      else
+      {
+        WerrorS("Z/p+...");
         return -1;
       }
     }
-    else if (r1->cf->ch==-1) /* R */
+    else if (getCoeffType(r1->cf)==n_R)
     {
       WerrorS("R+..");
       return -1;
     }
-    else if (r1->cf->ch==0) /* Q */
-    {
-      if ((r2->cf->ch<-1)||(r2->cf->ch==1)) /* Z/p(a),Q(a) */
-      {
-        tmpR.cf->ch=r2->cf->ch;
-        tmpR.cf->P=rPar(r2);
-        tmpR.cf->parameter=(char **)omAlloc(rPar(r2)*sizeof(char *));
-        int i;
-        for (i=0;i<rPar(r2);i++)
-        {
-          tmpR.cf->parameter[i]=omStrDup(r2->cf->parameter[i]);
-        }
-        if (r2->cf->minpoly!=NULL)
-        {
-          tmpR.cf->minpoly=n_Copy(r2->cf->minpoly, r2->cf);
-        }
-      }
-      else if (r2->cf->ch>1) /* Z/p,GF(p,n) */
-      {
-        tmpR.cf->ch=r2->cf->ch;
-        if (r2->cf->parameter!=NULL)
-        {
-          tmpR.cf->parameter=(char_ptr *)omAllocBin(char_ptr_bin);
-          tmpR.cf->P=1;
-          tmpR.cf->parameter[0]=omStrDup(r2->cf->parameter[0]);
-        }
+    else if (getCoeffType(r1->cf)==n_Q)
+    {
+      if (getCoeffType(r2->cf)==n_Zp)
+      {
+        tmpR.cf=r2->cf;
+        r2->cf->ref++;
       }
       else
       {
-        WerrorS("Q+R");
-        return -1; /* R */
-      }
-    }
-    else if (r1->cf->ch==1) /* Q(a) */
-    {
-      if (r2->cf->ch==0) /* Q */
-      {
-        tmpR.cf->ch=r1->cf->ch;
-        tmpR.cf->P=rPar(r1);
-        tmpR.cf->parameter=(char **)omAlloc(rPar(r1)*sizeof(char *));
-        int i;
-        for(i=0;i<rPar(r1);i++)
-        {
-          tmpR.cf->parameter[i]=omStrDup(r1->cf->parameter[i]);
-        }
-        if (r1->cf->minpoly!=NULL)
-        {
-          tmpR.cf->minpoly=n_Copy(r1->cf->minpoly, r1->cf);
-        }
-      }
-      else  /* R, Z/p,GF(p,n) */
-      {
-        WerrorS("Q(a)+(R,Z/p,GF(p,n))");
+        WerrorS("Q+...");
         return -1;
       }
     }
-    else /* r1->cf->ch >=2 , Z/p */
-    {
-      if (r2->cf->ch==0) /* Q */
-      {
-        tmpR.cf->ch=r1->cf->ch;
-      }
-      else if (r2->cf->ch==-r1->cf->ch) /* Z/p(a) */
-      {
-        tmpR.cf->ch=r2->cf->ch;
-        tmpR.cf->P=rPar(r2);
-        tmpR.cf->parameter=(char **)omAlloc(rPar(r2)*sizeof(char *));
-        int i;
-        for(i=0;i<rPar(r2);i++)
-        {
-          tmpR.cf->parameter[i]=omStrDup(r2->cf->parameter[i]);
-        }
-        if (r2->cf->minpoly!=NULL)
-        {
-          tmpR.cf->minpoly=n_Copy(r2->cf->minpoly, r2->cf);
-        }
-      }
-      else
-      {
-        WerrorS("Z/p+(GF(q,n),Z/q(a),R,Q(a))");
-        return -1; /* GF(p,n),Z/q(a),R,Q(a) */
-      }
+    else
+    {
+      WerrorS("coeff sum not yet implemented");
+      return -1;
     }
   }
@@ -1349,9 +1273,9 @@
     for (int for_i=0;for_i<IDELEMS(r1->qideal);for_i++)
       Q1->m[for_i] = p_PermPoly(
-				r1->qideal->m[for_i], perm1,
-				r1, sum,
-				nMap1, 
-				par_perm1, rPar(r1));
-    
+                                r1->qideal->m[for_i], perm1,
+                                r1, sum,
+                                nMap1,
+                                par_perm1, rPar(r1));
+
     omFree((ADDRESS)perm1);
   }
@@ -1369,12 +1293,12 @@
     nMapFunc nMap2 = n_SetMap(r2->cf,sum->cf);
     Q2 = idInit(IDELEMS(r2->qideal),1);
-     
+
     for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++)
-      Q2->m[for_i] = p_PermPoly( 
-		  r2->qideal->m[for_i], perm2, 
-		  r2, sum, 
-		  nMap2, 
-		  par_perm2, rPar(r2));
-    
+      Q2->m[for_i] = p_PermPoly(
+                  r2->qideal->m[for_i], perm2,
+                  r2, sum,
+                  nMap2,
+                  par_perm2, rPar(r2));
+
     omFree((ADDRESS)perm2);
   }
@@ -1417,6 +1341,4 @@
 ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
 {
-  TODO(Hans, "Please consider the change to '->cf'...");
-  
   if (r == NULL) return NULL;
   int i,j;
@@ -1435,19 +1357,7 @@
   //struct omBin   PolyBin; /* Bin from where monoms are allocated */
   //memset: res->PolyBin=NULL; // rComplete
-  res->cf->ch=r->cf->ch;     /* characteristic */
-#ifdef HAVE_RINGS
-  res->cf->ringtype = r->cf->ringtype;  // cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m
-  if (r->cf->modBase!=NULL)
-  {
-    res->cf->modBase = (int_number) omAlloc(sizeof(mpz_t));
-    mpz_init_set(res->cf->modBase,r->cf->modBase);
-  }
-  res->cf->modExponent=r->cf->modExponent;
-  if (r->cf->modNumber!=NULL)
-  {
-    res->cf->modNumber = (int_number) omAlloc(sizeof(mpz_t));
-    mpz_init_set(res->cf->modNumber,r->cf->modNumber);
-  }
-#endif
+  res->cf=r->cf;     /* coeffs */
+  res->cf->ref++;
+
   //memset: res->ref=0; /* reference counter to the ring */
 
@@ -1456,5 +1366,4 @@
 
   res->N=rVar(r);      /* number of vars */
-  res->cf->P=rPar(r);      /* number of pars */
   res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */
 
@@ -1504,7 +1413,4 @@
   //memset: res->cf=NULL;
   res->options=r->options;
-#ifdef HAVE_RINGS
-  res->cf->ringtype=r->cf->ringtype;
-#endif
   //
   if (r->algring!=NULL)
@@ -1512,19 +1418,4 @@
   res->algring=r->algring;
   //memset: res->minideal=NULL;
-  if (r->cf->parameter!=NULL)
-  {
-    if (r->cf->minpoly!=NULL) res->cf->minpoly=n_Copy(r->cf->minpoly,r->cf);
-    int l=rPar(r);
-    res->cf->parameter=(char **)omAlloc(l*sizeof(char *));
-    int i;
-    for(i=0;i<rPar(r);i++)
-    {
-      res->cf->parameter[i]=omStrDup(r->cf->parameter[i]);
-    }
-    if (r->minideal!=NULL)
-    {
-      res->minideal=id_Copy(r->minideal,r->algring);
-    }
-  }
   if (copy_ordering == TRUE)
   {
@@ -1794,5 +1685,5 @@
   if (blocks == 1) return TRUE;
 
-  int s = 0; 
+  int s = 0;
   while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
   {
@@ -1804,5 +1695,5 @@
 
   assume( blocks == s + 2 );
-  
+
   if (
      (r->order[s] != ringorder_c)
@@ -1869,5 +1760,5 @@
   if (blocks == 1) return TRUE;
 
-  int s = 0; 
+  int s = 0;
   while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
   {
@@ -1877,5 +1768,5 @@
 
   if ((blocks - s) > 3)  return FALSE;
-  
+
 //  if ((blocks > 3) || (blocks < 2)) return FALSE;
   if ((blocks - s) == 3)
@@ -2782,5 +2673,5 @@
           ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
           assume(
-            rSetISReference( res, 
+            rSetISReference( res,
               F,  // WILL BE COPIED!
               r->typ[i].data.is.limit,
@@ -3152,5 +3043,5 @@
       ||(
     ((order[1]==ringorder_c)||(order[1]==ringorder_C)
-     ||(order[1]==ringorder_S) 
+     ||(order[1]==ringorder_S)
      ||(order[1]==ringorder_s))
     && (order[0]!=ringorder_M)
@@ -3243,5 +3134,5 @@
     r->pFDeg = p_WTotaldegree; // may be improved: p_Totaldegree for lp/dp/ls/.. blocks
   }
-  
+
   if (rOrd_is_Totaldegree_Ordering(r) || rOrd_is_WeightedDegree_Ordering(r))
     r->pFDeg = p_Deg;
@@ -4052,5 +3943,5 @@
 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
     Print("\npFDeg   : ");
-    
+
     pFDeg_CASE(p_Totaldegree); else
       pFDeg_CASE(p_WFirstTotalDegree); else
@@ -4058,9 +3949,9 @@
       pFDeg_CASE(p_Deg); else
       Print("(%p)", r->pFDeg); // default case
-    
+
     PrintS("\n");
 #undef pFDeg_CASE
   }
-    
+
 }
 
@@ -4191,5 +4082,5 @@
 {
   assume(r->typ[1].ord_typ == ro_syzcomp);
-      
+
   r->typ[1].data.syzcomp.length = length;
   rNChangeSComps( currComponents, currShiftedComponents, r);
@@ -4201,5 +4092,5 @@
 {
   assume(r->typ[1].ord_typ == ro_syzcomp);
-  
+
   *length = r->typ[1].data.syzcomp.length;
   rNGetSComps( currComponents, currShiftedComponents, r);
@@ -5441,5 +5332,5 @@
   /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
 
-  id_Test((ideal)C, dest); 
+  id_Test((ideal)C, dest);
   id_Test((ideal)D, dest);
 
