Index: Singular/misc_ip.cc
===================================================================
--- Singular/misc_ip.cc	(revision 5ff1d31f3d80f972b5abf4d4435d01cb9b033ffb)
+++ Singular/misc_ip.cc	(revision a8ee9fd4127d41a25614239acf6eebbd463a5c9c)
@@ -6,8 +6,5 @@
  * This file provides miscellaneous functionality.
  *
- * For more general information, see the documentation in
- * misc_ip.h.
- *
- * @author Frank Seelisch
+ * For more general information, see the documentation in misc_ip.h.
  *
  * @internal @version \$Id$
@@ -18,24 +15,25 @@
 // include header files
 #include <kernel/mod2.h>
-#include <Singular/lists.h>
-#include <kernel/longrat.h>
-#include <Singular/misc_ip.h>
-#include <Singular/feOpt.h>
-#include <Singular/silink.h>
+#include <misc/auxiliary.h>
+
+#include "misc_ip.h"
+#include "ipid.h"
+
+#include <coeffs/coeffs.h>
+// #include <coeffs/longrat.h>
+
+#include "feOpt.h"
+#include "silink.h"
 
 void number2mpz(number n, mpz_t m)
 {
-  if (SR_HDL(n) & SR_INT) mpz_init_set_si(m, SR_TO_INT(n));     /* n fits in an int */
-  else             mpz_init_set(m, (mpz_ptr)n->z);
+  n_MPZ(m, n, coeffs_BIGINT);
 }
 
 number mpz2number(mpz_t m)
 {
-  number z = ALLOC_RNUMBER();
-  mpz_init_set(z->z, m);
-  mpz_init_set_ui(z->n, 1);
-  z->s = 3;
-  return z;
-}
+  return n_Init(m, coeffs_BIGINT);
+}
+
 
 void divTimes(mpz_t n, mpz_t d, int* times)
@@ -111,6 +109,5 @@
   else
   {
-    number nn = nlRInit(ui);
-    mpz_set_ui(nn->z,ui);
+    number nn = n_Init(ui, coeffs_BIGINT);
     L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
   }
@@ -176,4 +173,6 @@
 */
 
+
+
 /* n and pBound are assumed to be bigint numbers */
 lists primeFactorisation(const number n, const number pBound)
@@ -188,7 +187,7 @@
   int positive=1; int probTest = 0;
 
-  if (!nlIsZero(n))
-  {
-    if (!nlGreaterZero(n))
+  if (!n_IsZero(n, coeffs_BIGINT))
+  {
+    if (!n_GreaterZero(n, coeffs_BIGINT))
     {
       positive=-1;
@@ -332,32 +331,27 @@
 }
 
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <time.h>
-
+#include <omalloc/omalloc.h>
 #include <omalloc/mylimits.h>
-#include <omalloc/omalloc.h>
+
 #include <misc/options.h>
-#include <kernel/febase.h>
-#include <Singular/cntrlc.h>
-#include <kernel/page.h>
-#include <Singular/ipid.h>
-#include <Singular/ipshell.h>
-#include <kernel/kstd1.h>
-#include <Singular/subexpr.h>
-#include <kernel/timer.h>
 #include <misc/intvec.h>
+
 #include <polys/monomials/ring.h>
 #include <polys/templates/p_Procs.h>
-/* Needed for debug Version of p_SetRingOfLeftv, Oliver */
-#ifdef PDEBUG
-#include <polys/polys.h>
-#endif
-#include <Singular/version.h>
-
-#include <Singular/static.h>
+
+#include <kernel/febase.h>
+#include <kernel/page.h>
+#include <kernel/kstd1.h>
+#include <kernel/timer.h>
+
+
+#include "subexpr.h"
+#include "cntrlc.h"
+#include "ipid.h"
+#include "ipshell.h"
+
+#include "version.h"
+#include "static.h"
+
 #ifdef HAVE_STATIC
 #undef HAVE_DYN_RL
@@ -372,5 +366,5 @@
 #ifdef HAVE_FACTORY
 #define SI_DONT_HAVE_GLOBAL_VARS
-#include <factory/factory.h>
+//#include <factory/factory.h>
 // libfac:
   extern const char * libfac_version;
@@ -399,4 +393,12 @@
 *}
 */
+
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <time.h>
+
 
 void singular_example(char *str)
Index: Singular/misc_ip.h
===================================================================
--- Singular/misc_ip.h	(revision 5ff1d31f3d80f972b5abf4d4435d01cb9b033ffb)
+++ Singular/misc_ip.h	(revision a8ee9fd4127d41a25614239acf6eebbd463a5c9c)
@@ -15,5 +15,5 @@
  *           these algorithms have been moved to the C/C++ kernel.
  *
- * @author Frank Seelisch
+ * @author Frank Seelisch, Oleksandr Motsak
  *
  * @internal @version \$Id$
@@ -25,25 +25,11 @@
 #define MISC_H
 
+#include <misc/auxiliary.h>
+#include <coeffs/coeffs.h>
+
+#include <kernel/structs.h>
 #include <coeffs/si_gmp.h>
-#include <kernel/structs.h>
 
-// include basic SINGULAR structures
-/* So far nothing is required. */
-
-/**
- * Converts a non-negative bigint number into a GMP number.
- *
- **/
-void number2mpz(number n,   /**< [in]  a bigint number >= 0  */
-                mpz_t m     /**< [out] the GMP equivalent    */
-               );
-               
-/**
- * Converts a non-negative GMP number into a bigint number.
- *
- * @return the bigint number representing the given GMP number
- **/
-number mpz2number(mpz_t m   /**< [in]  a GMP number >= 0  */
-                 );
+#include <Singular/lists.h>
 
 /**
