Index: kernel/gr_kstd2.cc
===================================================================
--- kernel/gr_kstd2.cc	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ kernel/gr_kstd2.cc	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -21,4 +21,5 @@
 #include <polys/monomials/ring.h>
 
+#include <polys/nc/gb_hack.h>
 #include <polys/nc/nc.h>
 #include <polys/nc/sca.h>
@@ -32,6 +33,7 @@
 //#include "cntrlc.h"
 #include <kernel/ratgring.h>
-
 #include <kernel/kutil.h>
+
+#include <kernel/nc.h>
 
 #if 0
@@ -1043,6 +1045,8 @@
 #define MYTEST 0
 
-ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat)
+ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 {
+  const ring save = currRing; if( currRing != _currRing ) rChangeCurrRing(_currRing);
+
 #if MYTEST
    PrintS("<gnc_gr_bba>\n");
@@ -1298,14 +1302,17 @@
 #endif
 
+  if( currRing != save )     rChangeCurrRing(save);
+  
   return (strat->Shdl);
 }
 
-ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy)
+ideal gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 {
-  PrintS("Sorry, non-commutative mora is not yet implemented!");
-  PrintLn();
-
+#ifndef NDEBUG
   // Not yet!
-  return NULL;
+  WarnS("Sorry, non-commutative mora is not yet implemented!");
+#endif
+
+  return gnc_gr_bba(F, Q, NULL, NULL, strat, _currRing);
 }
 
Index: kernel/nc.cc
===================================================================
--- kernel/nc.cc	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ kernel/nc.cc	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -1,2 +1,4 @@
+#define PLURAL_INTERNAL_DECLARATIONS
+   
 #include "mod2.h"
 #include <misc/auxiliary.h>
@@ -5,12 +7,13 @@
 
 #include <polys/simpleideals.h>
+#include <polys/prCopy.h>
+#include <polys/nc/gb_hack.h>
+
 #include <kernel/polys.h>
 
-#include <polys/prCopy.h>
-
-#include "ideals.h"
-#include "kstd1.h"
-
-#include "nc.h"
+#include <kernel/ideals.h>
+#include <kernel/kstd1.h>
+
+#include <kernel/nc.h>
 
 ideal twostd(ideal I) // works in currRing only!
@@ -411,3 +414,2 @@
   }
 }
-
Index: kernel/nc.h
===================================================================
--- kernel/nc.h	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ kernel/nc.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -1,5 +1,21 @@
 #ifndef KERNEL_NC_H
 #define KERNEL_NC_H
+
 #ifdef HAVE_PLURAL
+
+#ifdef PLURAL_INTERNAL_DECLARATIONS
+
+# include <polys/nc/gb_hack.h>
+
+#else // #ifdef PLURAL_INTERNAL_DECLARATIONS
+
+# define PLURAL_INTERNAL_DECLARATIONS
+# include <polys/nc/gb_hack.h>
+# undef PLURAL_INTERNAL_DECLARATIONS
+
+#endif // #ifdef PLURAL_INTERNAL_DECLARATIONS
+
+
+#include <misc/auxiliary.h>
 
 #include <polys/nc/nc.h>
@@ -7,4 +23,35 @@
 
 #include <kernel/polys.h>
+
+
+
+static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
+{
+  assume(rIsPluralRing(r));
+  assume(r->GetNC()->p_Procs.GB!=NULL);
+
+  GB_Proc_Ptr gb = cast_A_to_B<void*, GB_Proc_Ptr>(r->GetNC()->p_Procs.GB);
+
+  // NOTE: the following code block is a hack in order to make a linker to
+  // believe in these functions but in reallity it should not be used.
+  // Although it can also serve as an illustration for the
+  // NC-initialization procedure for GB hidden away (hackedly) in
+  // libpolys.
+  // The only other solution would be to separate GB and the whole NC
+  // subsystems from both libpolys AND kernel... which would require
+  // too much effort and thus cannot be done right now.
+  // Therefore this is a TODO for a future (large-scale) cleanup.
+  if( gb == NULL)
+  {
+      if (rHasLocalOrMixedOrdering(r))
+        gb = gnc_gr_mora;
+      else
+        gb = gnc_gr_bba;
+    
+    r->GetNC()->p_Procs.GB = cast_A_to_vptr(gb);
+  }
+
+  return gb(F, Q, w, hilb, strat, r);
+}
 
 /// Compute two-sided GB:
@@ -14,86 +61,5 @@
 ideal Approx_Step(ideal L);
 
-class skStrategy;
-typedef skStrategy * kStrategy;
+#endif // HAVE_PLURAL
 
-// ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy/*, const ring r*/); // Not yet!
-ideal gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat/*, const ring r*/);
-
-
-static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
-{
-  assume(rIsPluralRing(r));
-   
-  const ring save = currRing;
-   
-  if( save != r )
-     rChangeCurrRing(r);
-   
-///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
-// old ///    r->GetNC()->GB()            = gnc_gr_bba;
-   
-//   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
-//   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
-   
-//  assume(r->GetNC()->p_Procs.GB!=NULL);
-//  return r->GetNC()->p_Procs.GB(F, Q, w, hilb, strat, r);
-  ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
-   
-   
-/*
-// Modified Plural's Buchberger's algorithmus.
-ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing);
-
-// Modified modern Sinuglar Buchberger's algorithm.
-ideal sca_bba(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
-
-// Modified modern Sinuglar Mora's algorithm.
-ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
-*/
-
-   
-/*
-  if (rHasLocalOrMixedOrdering(rGR))
-  {
-#ifdef PDEBUG
-//           Print("Local case => GB == mora!\n");
-#endif
-    rGR->GetNC()->p_Procs.GB          = NULL; // sca_mora; // local ordering => Mora, otherwise - Buchberger!
-  }
-  else
-  {
-#ifdef PDEBUG
-//           Print("Global case => GB == bba!\n");
-#endif
-    rGR->GetNC()->p_Procs.GB          = NULL; // sca_bba; // sca_gr_bba; // sca_bba? // sca_bba;
-  }
-//   rGR->GetNC()->p_Procs.GlobalGB    = sca_gr_bba;
-//   rGR->GetNC()->p_Procs.LocalGB     = sca_mora;
-
-   
-/////        r->GetNC()->GB()            = sca_gr_bba;
-*/
-  if( save != r )
-     rChangeCurrRing(save);
-   
-  return (res);
-}
-/*
-
-// typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r);
-  GB_Proc_Ptr                           GB;
-//                                         GlobalGB, // BBA
-//                                         LocalGB;  // MORA
-*/
-
-
-#ifdef PLURAL_INTERNAL_DECLARATIONS
-
-/// we need nc_gr_initBba for sca_gr_bba and gr_bba.
-void nc_gr_initBba(ideal F,kStrategy strat); 
-#endif // PLURAL_INTERNAL_DECLARATIONS
-
-
-
-#endif // HAVE_PLURAL
 #endif // KERNEL_NC_H
Index: libpolys/polys/Makefile.am
===================================================================
--- libpolys/polys/Makefile.am	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ libpolys/polys/Makefile.am	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -43,5 +43,5 @@
 
 LIBPOLYSHEADERS = monomials/ring.h monomials/monomials.h \
-	nc/nc.h nc/sca.h nc/summator.h nc/ncSAFormula.h nc/ncSACache.h nc/ncSAMult.h \
+	nc/nc.h nc/sca.h nc/summator.h nc/ncSAFormula.h nc/ncSACache.h nc/ncSAMult.h nc/gb_hack.h \
 	operations/pShallowCopyDelete.h \
 	templates/p_Procs.h templates/p_MemAdd.h templates/p_MemCmp.h \
Index: libpolys/polys/nc/gb_hack.h
===================================================================
--- libpolys/polys/nc/gb_hack.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
+++ libpolys/polys/nc/gb_hack.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -0,0 +1,72 @@
+#ifndef POLYS_NC_GB_HACK_H
+#define POLYS_NC_GB_HACK_H
+
+#ifdef HAVE_PLURAL
+
+#ifdef PLURAL_INTERNAL_DECLARATIONS
+
+struct  spolyrec;
+typedef struct spolyrec    polyrec;
+typedef polyrec *          poly;
+
+struct ip_sring;
+typedef struct ip_sring *         ring;
+
+class intvec;
+
+struct sip_sideal;
+typedef struct sip_sideal *       ideal;
+
+class skStrategy; typedef skStrategy * kStrategy;
+typedef ideal (*GB_Proc_Ptr)(const ideal, const ideal, const intvec*, const intvec*, kStrategy, const ring);
+
+
+ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing);
+ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing);
+
+/// Modified Plural's Buchberger's algorithmus.
+ideal sca_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing);
+
+/// Modified modern Sinuglar Buchberger's algorithm.
+ideal sca_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing);
+
+/// Modified modern Sinuglar Mora's algorithm.
+ideal sca_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing);
+
+poly kNF(ideal, ideal, poly, int, int, const ring _currRing);
+
+
+
+# ifdef PLURAL_INTERNAL_DECLARATIONS_GB_HACK
+
+extern void WerrorS(const char *);
+
+# define STR_EXPAND(tok) #tok
+# define D(A) A \
+{               \
+                WerrorS("This is a hack. Function is not defined: " \
+                        STR_EXPAND(A) \
+                       ); \
+}
+
+D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
+D(ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
+
+/// Modified Plural's Buchberger's algorithmus.
+D(ideal sca_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
+
+/// Modified modern Sinuglar Buchberger's algorithm.
+D(ideal sca_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
+
+/// Modified modern Sinuglar Mora's algorithm.
+D(ideal sca_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
+
+D(poly kNF(ideal, ideal, poly, int, int, const ring _currRing))
+
+#endif // # ifdef PLURAL_INTERNAL_DECLARATIONS_GB_HACK
+#endif // PLURAL_INTERNAL_DECLARATIONS
+
+
+#endif // HAVE_PLURAL
+#endif // POLYS_NC_GB_HACK_H
+
Index: libpolys/polys/nc/nc.h
===================================================================
--- libpolys/polys/nc/nc.h	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ libpolys/polys/nc/nc.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -2,14 +2,11 @@
 #define POLYS_NC_H
 
+#include <polys/monomials/ring.h>
+#include <polys/kbuckets.h>
 
 #ifdef HAVE_PLURAL
-
-
 
 // TODO: the following is a part of ring.h... would be nice to have a
 // clear public NC interface defined here!
-
-#include <polys/monomials/ring.h>
-#include <polys/kbuckets.h>
 
 
@@ -75,4 +72,8 @@
   SPoly_Proc_Ptr                        SPoly;
   SPolyReduce_Proc_Ptr                  ReduceSPoly;
+
+  void*                                 GB; ///< From "gb_hack.h"
+//                                         GlobalGB, // BBA
+//                                         LocalGB;  // MORA
 };
 
@@ -312,12 +313,6 @@
 }
 
-
 /* subst: */
 poly nc_pSubst(poly p, int n, poly e, const ring r);
-
-// set pProcs table for rGR and global variable p_Procs
-// this should be used by p_ProcsSet in p_Procs_Set.h
-void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
-
 
 // the part, related to the interface
@@ -332,10 +327,9 @@
 
 
-BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
-
 // this function should be used inside QRing definition!
 // we go from rG into factor ring rGR with factor ideal rGR->qideal.
 bool nc_SetupQuotient(ring rGR, const ring rG = NULL, bool bCopy = false); // rG == NULL means that there is no base G-algebra
 
+BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
 
 bool nc_rCopy(ring res, const ring r, bool bSetupQuotient);
@@ -372,4 +366,9 @@
 
 #ifdef PLURAL_INTERNAL_DECLARATIONS
+
+// set pProcs table for rGR and global variable p_Procs
+// this should be used by p_ProcsSet in p_Procs_Set.h
+void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
+
 
 #include <polys/matpol.h>
@@ -398,5 +397,5 @@
 }
 
-#endif /* PLURAL_INTERNAL_DECLARATIONS */
+#endif // PLURAL_INTERNAL_DECLARATIONS
 
 #endif /* HAVE_PLURAL */
Index: libpolys/polys/nc/old.gring.cc
===================================================================
--- libpolys/polys/nc/old.gring.cc	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ libpolys/polys/nc/old.gring.cc	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -26,5 +26,8 @@
 #include "nc/nc.h"
 #include "nc/sca.h"
-
+#include "nc/gb_hack.h"
+
+#include "monomials/ring.h"
+   
 #include <coeffs/numbers.h>
 #include "coeffrings.h"
@@ -121,7 +124,4 @@
 poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r);
 
-
-// set pProcs for r and global variable p_Procs as for general non-commutative algebras.
-void gnc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
 
 /* syzygies : */
@@ -2748,7 +2748,6 @@
 
 
+
 BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
-
-
 
 /// returns TRUE if there were errors
@@ -3064,5 +3063,10 @@
   // Setup new NC structure!!!
   if (r->GetNC() != NULL)
+  {
+#ifndef NDEBUG
+    WarnS("Changing the NC-structure of an existing NC-ring!!!");
+#endif    
     nc_rKill(r);
+  }
 
   r->GetNC() = nc_new;
@@ -3171,22 +3175,12 @@
   }
   r->GetNC()->COM=COM;
+  
 
   nc_p_ProcsSet(r, r->p_Procs);
 
   if(bSetupQuotient) // Test me!!!
-  {
-    nc_SetupQuotient(r);
-  }
-
-
-  // ???
-  if( bNoPluralMultiplication )
-    ncInitSpecialPairMultiplication(r);
-
-
-  if(!rIsSCA(r) && !bNoFormula)
-    ncInitSpecialPowersMultiplication(r);
-
-
+    nc_SetupQuotient(r, NULL, false); // no copy!
+
+  
 //  if (save != currRing)
 //    rChangeCurrRing(save);
@@ -3195,4 +3189,7 @@
 }
 
+
+// set pProcs for r and global variable p_Procs as for general non-commutative algebras.
+static inline
 void gnc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs)
 {
@@ -3225,5 +3222,17 @@
 #endif
 
-
+  // warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object?
+  if (rHasLocalOrMixedOrdering(rGR))
+    rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_mora);
+  else
+    rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_bba);
+
+///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
+// old ///    r->GetNC()->GB()            = gnc_gr_bba;
+//   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
+//   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
+//  const ring save = currRing; if( save != r ) rChangeCurrRing(r);
+//  ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
+//  if( save != r )     rChangeCurrRing(save);     return (res);
 
 
@@ -3261,6 +3270,12 @@
     sca_p_ProcsSet(rGR, p_Procs);
   }
-}
-
+
+  if( bNoPluralMultiplication )
+    ncInitSpecialPairMultiplication(rGR);
+
+  if(!rIsSCA(rGR) && !bNoFormula)
+    ncInitSpecialPowersMultiplication(rGR);
+
+}
 
 
Index: libpolys/polys/nc/old.gring.h
===================================================================
--- libpolys/polys/nc/old.gring.h	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ libpolys/polys/nc/old.gring.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -121,26 +121,3 @@
 }
 
-inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat)
-{
-  assume(rIsPluralRing(currRing));
-
-  assume(currRing->GetNC()->p_Procs.GB!=NULL);
-  return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
-
-/*
-  if (rHasLocalOrMixedOrder(currRing))
-  {
-    assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
-    return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
-  } else
-  {
-    assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
-    return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
-  }
-*/
-}
-
-
-
-
 #endif // 
Index: libpolys/polys/templates/p_Procs_Set.h
===================================================================
--- libpolys/polys/templates/p_Procs_Set.h	(revision 1adae39f1ae788b310c426226af46794834f1fac)
+++ libpolys/polys/templates/p_Procs_Set.h	(revision 80ca3c62104a8ede71139b7dae3090f767870f7c)
@@ -16,9 +16,4 @@
 #include <coeffs/modulop.h>
 
-#ifdef HAVE_PLURAL
-// for nc_p_ProcsSet:
-// #include <polys/nc/....h>
-#endif
-
 #include <reporter/reporter.h>
 
@@ -140,4 +135,6 @@
 }                                                           \
 while (0);
+
+void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
 
 // Choose a set of p_Procs
@@ -192,6 +189,6 @@
   if (rIsPluralRing(r))
   {
-     dReportError("Setting pProcs in p_ProcsSet (rDebugPrint!?)!!!");
-     nc_p_ProcsSet(r, _p_procs); // Setup non-commutative p_Procs table!
+    dReportError("Setting pProcs in p_ProcsSet (rDebugPrint!?)!!!");
+    nc_p_ProcsSet(r, _p_procs); // Setup non-commutative p_Procs table!
   }
 #endif
