Index: kernel/kutil.cc
===================================================================
--- kernel/kutil.cc	(revision a7541b59e5f1a2bdd1a3d8749700ceb15bb5b7a7)
+++ kernel/kutil.cc	(revision b1c0a9e98fc3aee487e8cd43be67cb47d4352fe7)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: kutil.cc,v 1.131 2009-02-27 11:21:24 Singular Exp $ */
+/* $Id: kutil.cc,v 1.132 2009-04-08 17:21:58 motsak Exp $ */
 /*
 * ABSTRACT: kernel: utils for kStd
@@ -3091,8 +3091,30 @@
     }
   }
+
+  if (strat->noClearS) return;
+  
 //   #ifdef HAVE_PLURAL
-  if (!rIsPluralRing(currRing))
-//   #endif
-  {
+/*
+  if (rIsPluralRing(currRing))
+  {
+    j=pos;
+    loop
+    {
+      if (j > k) break;
+
+      if (pLmDivisibleBy(h, strat->S[j]))
+      {
+        deleteInS(j, strat);
+        j--;
+        k--;
+      }
+      
+      j++;
+    }
+  }    
+  else
+*/  
+//   #endif // ??? Why was the following cancelation disabled for non-commutative rings? 
+  { 
     j=pos;
     loop
Index: kernel/sca.cc
===================================================================
--- kernel/sca.cc	(revision a7541b59e5f1a2bdd1a3d8749700ceb15bb5b7a7)
+++ kernel/sca.cc	(revision b1c0a9e98fc3aee487e8cd43be67cb47d4352fe7)
@@ -7,5 +7,5 @@
  *  Author:  motsak (Oleksandr Motsak)
  *  Created: 2006/12/18
- *  Version: $Id: sca.cc,v 1.35 2009-04-03 19:10:36 motsak Exp $
+ *  Version: $Id: sca.cc,v 1.36 2009-04-08 17:21:58 motsak Exp $
  *******************************************************************/
 
@@ -1720,5 +1720,5 @@
   /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
   // ?? set spSpolyShort, reduce ???
-  initBuchMora(tempF, tempQ, strat); // tempQ = Q - squares!!!
+  initBuchMora(tempF, tempQ, strat); // tempQ = Q without squares!!!
 
 //   if (strat->minim>0) strat->M = idInit(IDELEMS(F),F->rank);
@@ -1749,4 +1749,61 @@
   ///////////////////////////////////////////////////////////////
   // SCA:
+
+  //  due to std( SB, p).
+  // Note that after initBuchMora :: initSSpecial all these additional
+  // elements are in S and T (and some pairs are in L, which also has no initiall
+  // elements!!!)
+  if(TEST_OPT_SB_1)
+  {
+    // For all additional elements...
+    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
+    {
+      const poly pSave = tempF->m[iNewElement];
+
+      if( pSave != NULL )
+      {
+//        tempF->m[iNewElement] = NULL;
+
+        const poly p_next = pNext(pSave);
+
+        if(p_next != NULL)
+          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+            if( p_GetExp(pSave, i, currRing) != 0 )
+            {
+              assume(p_GetExp(pSave, i, currRing) == 1);
+
+              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+              p_Test(p_new, currRing);
+#endif
+
+              if( p_new == NULL) continue;
+
+              LObject h(p_new); // h = x_i * strat->P
+
+              if (TEST_OPT_INTSTRATEGY)
+                h.pCleardenom(); // also does a pContent
+              else
+                h.pNorm();
+
+              strat->initEcart(&h);
+              h.sev = pGetShortExpVector(h.p);
+
+              int pos = 0;
+
+              if (strat->Ll != -1)
+                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+            }          
+
+      }        
+
+    }
+  } 
+
+  
+  
 
   /* compute------------------------------------------------------- */
@@ -1914,5 +1971,6 @@
         if (TEST_OPT_INTSTRATEGY)
         {
-          pContent(h.p);
+//          pContent(h.p);
+          h.pCleardenom(); // also does a pContent
         }
         else
@@ -1924,8 +1982,7 @@
         h.sev = pGetShortExpVector(h.p);
 
-        int pos;
-        if (strat->Ll==-1)
-          pos =0;
-        else
+        int pos = 0;
+
+        if (strat->Ll != -1)
           pos = strat->posInL(strat->L,strat->Ll,&h,strat);
 
@@ -2121,11 +2178,4 @@
 #endif
 
-  int srmax;
-  int lrmax = 0;
-  int olddeg = 0;
-  int reduc = 0;
-  int red_result = 1;
-//  int hilbeledeg=1;
-  int hilbcount=0;
 
   strat->update = TRUE;
@@ -2159,9 +2209,18 @@
   }
 #endif
-
-  srmax = strat->sl;
+  strat->use_buckets = kMoraUseBucket(strat);
+
   kTest_TS(strat);
 
-  strat->use_buckets = kMoraUseBucket(strat);
+
+  int srmax = strat->sl;
+  int lrmax = strat->Ll;
+  int olddeg = 0;
+  int reduc = 0;
+  int red_result = 1;
+//  int hilbeledeg=1;
+  int hilbcount=0;
+
+  
   /*- compute-------------------------------------------*/
 
@@ -2172,4 +2231,64 @@
 //     kStratInitChangeTailRing(strat);
 #endif
+
+
+
+
+  
+//  due to std( SB, p)
+  if(TEST_OPT_SB_1)
+  {
+    for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
+    {
+
+      const poly pSave = tempF->m[iNewElement];
+
+      if( pSave != NULL )
+      {
+//        tempF->m[iNewElement] = NULL;
+
+        const poly p_next = pNext(pSave);
+
+        if(p_next != NULL)
+          for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
+            if( p_GetExp(pSave, i, currRing) != 0 )
+            {
+
+              assume(p_GetExp(pSave, i, currRing) == 1);
+
+              const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
+
+#ifdef PDEBUG
+              p_Test(p_new, currRing);
+#endif
+
+              if( p_new == NULL) continue;
+
+              LObject h(p_new); // h = x_i * strat->P
+
+              if (TEST_OPT_INTSTRATEGY)
+                h.pCleardenom(); // also does a pContent
+              else
+                h.pNorm();
+
+              strat->initEcart(&h);
+              h.sev = pGetShortExpVector(h.p);
+
+              int pos = 0;
+
+              if (strat->Ll != -1)
+                pos = strat->posInL(strat->L,strat->Ll,&h,strat);
+
+              enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
+
+              if (strat->Ll>lrmax) lrmax = strat->Ll;
+            }          
+      
+      }      
+
+    }
+  } 
+
+
 
 
@@ -2309,9 +2428,7 @@
         h.sev = pGetShortExpVector(h.p);
 
-        int pos;
-
-        if (strat->Ll==-1)
-          pos = 0;
-        else
+        int pos = 0;
+
+        if (strat->Ll != -1)
           pos = strat->posInL(strat->L,strat->Ll,&h,strat);
 
