diff --git a/pcuic/theories/Bidirectional/BDStrengthening.v b/pcuic/theories/Bidirectional/BDStrengthening.v
index baf715008..0d898be85 100644
--- a/pcuic/theories/Bidirectional/BDStrengthening.v
+++ b/pcuic/theories/Bidirectional/BDStrengthening.v
@@ -11,7 +11,7 @@ From MetaCoq.PCUIC Require Import PCUICAst PCUICAstUtils PCUICGlobalEnv
 From MetaCoq.PCUIC Require Import BDTyping BDToPCUIC BDFromPCUIC.
 
 Require Import ssreflect ssrbool.
-Require Import Coq.Program.Equality.
+From Coq.Program Require Import Equality.
 
 Ltac case_inequalities :=
   match goal with
diff --git a/pcuic/theories/Syntax/PCUICDepth.v b/pcuic/theories/Syntax/PCUICDepth.v
index 71a94c8b1..ede5c7f42 100644
--- a/pcuic/theories/Syntax/PCUICDepth.v
+++ b/pcuic/theories/Syntax/PCUICDepth.v
@@ -1,5 +1,5 @@
 (* Distributed under the terms of the MIT license. *)
-From Coq Require Import ssreflect Program Lia BinPos Arith.Compare_dec Bool.
+From Coq Require Import ssreflect Program Lia BinPos Compare_dec Bool.
 From MetaCoq.Utils Require Import utils LibHypsNaming.
 From MetaCoq.PCUIC Require Import PCUICAst PCUICAstUtils PCUICCases PCUICSize PCUICInduction.
 From Coq Require Import List.
diff --git a/pcuic/theories/Syntax/PCUICInduction.v b/pcuic/theories/Syntax/PCUICInduction.v
index 3c2676cab..23ffeb79d 100644
--- a/pcuic/theories/Syntax/PCUICInduction.v
+++ b/pcuic/theories/Syntax/PCUICInduction.v
@@ -1,5 +1,5 @@
 (* Distributed under the terms of the MIT license. *)
-From Coq Require Import ssreflect Program Lia BinPos Arith.Compare_dec Bool.
+From Coq Require Import ssreflect Program Lia BinPos Compare_dec Bool.
 From MetaCoq.Utils Require Import utils LibHypsNaming.
 From MetaCoq.PCUIC Require Import PCUICAst PCUICAstUtils PCUICCases PCUICSize.
 From Coq Require Import List.
diff --git a/quotation/theories/ToPCUIC/Stdlib/Numbers.v b/quotation/theories/ToPCUIC/Stdlib/Numbers.v
index 65c0e8ea4..1b674023d 100644
--- a/quotation/theories/ToPCUIC/Stdlib/Numbers.v
+++ b/quotation/theories/ToPCUIC/Stdlib/Numbers.v
@@ -2,7 +2,7 @@ From Coq.Numbers Require Import BinNums DecimalFacts HexadecimalFacts
      Cyclic.Int63.PrimInt63 Cyclic.Int63.Uint63
      Cyclic.Abstract.CyclicAxioms
      Cyclic.Abstract.DoubleType
-     Cyclic.Abstract.CarryType
+     Cyclic.Int63.CarryType
 .
 
 From Coq Require Import ZArith.
diff --git a/quotation/theories/ToTemplate/Stdlib/Numbers.v b/quotation/theories/ToTemplate/Stdlib/Numbers.v
index 89fb4b9c6..f4473e30b 100644
--- a/quotation/theories/ToTemplate/Stdlib/Numbers.v
+++ b/quotation/theories/ToTemplate/Stdlib/Numbers.v
@@ -2,7 +2,7 @@ From Coq.Numbers Require Import BinNums DecimalFacts HexadecimalFacts
      Cyclic.Int63.PrimInt63 Cyclic.Int63.Uint63
      Cyclic.Abstract.CyclicAxioms
      Cyclic.Abstract.DoubleType
-     Cyclic.Abstract.CarryType
+     Cyclic.Int63.CarryType
 .
 From Coq Require Import ZArith.
 From MetaCoq.Quotation.ToTemplate Require Import Stdlib.Init.
diff --git a/safechecker-plugin/_PluginProject.in b/safechecker-plugin/_PluginProject.in
index 5a2c45cb5..a7abaade4 100644
--- a/safechecker-plugin/_PluginProject.in
+++ b/safechecker-plugin/_PluginProject.in
@@ -13,6 +13,8 @@ src/uGraph0.ml
 src/uGraph0.mli
 src/wGraph.ml
 src/wGraph.mli
+src/wf0.ml
+src/wf0.mli
 
 # From PCUIC
 src/pCUICPrimitive.mli
diff --git a/safechecker-plugin/clean_extraction.sh b/safechecker-plugin/clean_extraction.sh
index 85e2f761a..c1d6d1564 100755
--- a/safechecker-plugin/clean_extraction.sh
+++ b/safechecker-plugin/clean_extraction.sh
@@ -29,6 +29,11 @@ then
     done
     cd ..
 
+    # confusion between Init.Wf and Program.Wf
+    mv src/wf.ml src/wf0.ml
+    mv src/wf.mli src/wf0.mli
+    sed -i.bak src/pCUICSafeChecker.ml -e 's/open Wf/open Wf0/'
+
     # Remove extracted modules already linked in the template_coq plugin.
     echo "Removing:" $files
     rm -f $files
diff --git a/safechecker-plugin/src/metacoq_safechecker_plugin.mlpack b/safechecker-plugin/src/metacoq_safechecker_plugin.mlpack
index 5557f37d6..0aafddedf 100644
--- a/safechecker-plugin/src/metacoq_safechecker_plugin.mlpack
+++ b/safechecker-plugin/src/metacoq_safechecker_plugin.mlpack
@@ -4,6 +4,7 @@ WGraph
 UGraph0
 Reflect
 MCProd
+Wf0
 
 Classes0
 Logic1
diff --git a/safechecker-plugin/theories/Extraction.v b/safechecker-plugin/theories/Extraction.v
index 00a677373..4081b6fee 100644
--- a/safechecker-plugin/theories/Extraction.v
+++ b/safechecker-plugin/theories/Extraction.v
@@ -48,7 +48,7 @@ Next Obligation. eapply fake_abstract_guard_impl_properties. Qed.
 Definition infer_and_print_template_program_with_guard {cf} {nor} :=
   @SafeTemplateChecker.infer_and_print_template_program cf nor fake_abstract_guard_impl.
 
-Separate Extraction MakeOrderTac PCUICSafeChecker.typecheck_program
+Separate Extraction Wf.Fix_sub MakeOrderTac PCUICSafeChecker.typecheck_program
          infer_and_print_template_program_with_guard
          (* The following directives ensure separate extraction does not produce name clashes *)
          Stdlib.Strings.String UnivSubst PCUICPretty.
diff --git a/safechecker/theories/PCUICSafeChecker.v b/safechecker/theories/PCUICSafeChecker.v
index 48cf5a26a..9a43e0a71 100644
--- a/safechecker/theories/PCUICSafeChecker.v
+++ b/safechecker/theories/PCUICSafeChecker.v
@@ -106,7 +106,7 @@ Definition gcs_equal x y : Prop :=
 
 
 (** It otherwise tries [auto with *], very bad idea. *)
-Ltac Stdlib.Program.Tactics.program_solve_wf ::=
+Ltac Corelib.Program.Tactics.program_solve_wf ::=
   match goal with
   | |- @Wf.well_founded _ _ => auto with subterm wf
   | |- ?T => match type of T with
diff --git a/safechecker/theories/PCUICTypeChecker.v b/safechecker/theories/PCUICTypeChecker.v
index 68cbe06d2..21af8b0e2 100644
--- a/safechecker/theories/PCUICTypeChecker.v
+++ b/safechecker/theories/PCUICTypeChecker.v
@@ -25,7 +25,7 @@ From MetaCoq.SafeChecker Require Import PCUICEqualityDec PCUICSafeReduce PCUICEr
 
 From Equations Require Import Equations.
 Require Import ssreflect ssrbool.
-Require Import Stdlib.Program.Program.
+From Stdlib Require Import Program.
 
 Local Set Keyed Unification.
 Set Equations Transparent.
@@ -125,7 +125,7 @@ Proof.
 Qed.
 
 (** It otherwise tries [auto with *], very bad idea. *)
-Ltac Stdlib.Program.Tactics.program_solve_wf ::=
+Ltac Corelib.Program.Tactics.program_solve_wf ::=
   match goal with
   | |- @Wf.well_founded _ _ => auto with subterm wf
   | |- ?T => match type of T with
diff --git a/template-coq/Makefile b/template-coq/Makefile
index c5c4d27ae..972ccdc11 100644
--- a/template-coq/Makefile
+++ b/template-coq/Makefile
@@ -74,14 +74,7 @@ cleanplugin: Makefile.plugin
 	make -f Makefile.plugin clean
 
 PLUGIN_PROJECT_BLACKLIST := \
-	carryType \
-	coreTactics \
-	depElim \
-	floatClass \
-	init \
 	mCUint63 \
-	noConfusion \
-	wf \
 	#
 
 space := $(subst ,, )
diff --git a/template-coq/_PluginProject.in b/template-coq/_PluginProject.in
index abd10f638..f28ff7bb3 100644
--- a/template-coq/_PluginProject.in
+++ b/template-coq/_PluginProject.in
@@ -27,10 +27,6 @@ gen-src/binNums.ml
 gen-src/binNums.mli
 gen-src/binPos.ml
 gen-src/binPos.mli
-gen-src/binPosDef.ml
-gen-src/binPosDef.mli
-gen-src/decidableClass.mli
-gen-src/decidableClass.ml
 gen-src/bool.ml
 gen-src/bool.mli
 gen-src/byte.ml
@@ -64,6 +60,8 @@ gen-src/coreTactics.ml
 gen-src/coreTactics.mli
 gen-src/datatypes.ml
 gen-src/datatypes.mli
+gen-src/decidableClass.ml
+gen-src/decidableClass.mli
 gen-src/decidableType.ml
 gen-src/decidableType.mli
 gen-src/decimal.ml
@@ -101,20 +99,22 @@ gen-src/floatOps.ml
 gen-src/floatOps.mli
 gen-src/hexadecimal.ml
 gen-src/hexadecimal.mli
-# gen-src/hexadecimalString.ml
-# gen-src/hexadecimalString.mli
 gen-src/induction0.ml
 gen-src/induction0.mli
 gen-src/init.ml
 gen-src/init.mli
 gen-src/int0.ml
 gen-src/int0.mli
+gen-src/intDef.ml
+gen-src/intDef.mli
 gen-src/kernames.ml
 gen-src/kernames.mli
 gen-src/liftSubst.ml
 gen-src/liftSubst.mli
 gen-src/list0.ml
 gen-src/list0.mli
+gen-src/listDef.ml
+gen-src/listDef.mli
 gen-src/logic0.ml
 gen-src/logic0.mli
 gen-src/logic1.ml
@@ -141,10 +141,6 @@ gen-src/mCRelations.ml
 gen-src/mCRelations.mli
 gen-src/mCString.ml
 gen-src/mCString.mli
-gen-src/sint63.mli
-gen-src/sint63.ml
-gen-src/show.mli
-gen-src/show.ml
 # gen-src/mCUint63.ml
 # gen-src/mCUint63.mli
 gen-src/mCUtils.ml
@@ -165,6 +161,8 @@ gen-src/monad_utils.ml
 gen-src/monad_utils.mli
 gen-src/nat0.ml
 gen-src/nat0.mli
+gen-src/natDef.ml
+gen-src/natDef.mli
 gen-src/noConfusion.ml
 gen-src/noConfusion.mli
 gen-src/number.ml
@@ -187,6 +185,8 @@ gen-src/peanoNat.ml
 gen-src/peanoNat.mli
 gen-src/plugin_core.ml
 gen-src/plugin_core.mli
+gen-src/posDef.ml
+gen-src/posDef.mli
 gen-src/pretty.ml
 gen-src/pretty.mli
 gen-src/primFloat.ml
@@ -195,10 +195,10 @@ gen-src/primInt63.ml
 gen-src/primInt63.mli
 gen-src/primString.ml
 gen-src/primString.mli
-gen-src/primitive.ml
-gen-src/primitive.mli
 gen-src/primStringAxioms.ml
 gen-src/primStringAxioms.mli
+gen-src/primitive.ml
+gen-src/primitive.mli
 gen-src/quoter.ml
 gen-src/reflect.ml
 gen-src/reflect.mli
@@ -209,16 +209,18 @@ gen-src/relation.ml
 gen-src/relation.mli
 gen-src/run_extractable.ml
 gen-src/run_extractable.mli
+gen-src/show.ml
+gen-src/show.mli
 gen-src/signature.ml
 gen-src/signature.mli
+gen-src/sint63Axioms.ml
+gen-src/sint63Axioms.mli
 gen-src/specFloat.ml
 gen-src/specFloat.mli
 gen-src/specif.ml
 gen-src/specif.mli
 gen-src/string0.ml
 gen-src/string0.mli
-gen-src/sumbool.ml
-gen-src/sumbool.mli
 gen-src/templateEnvMap.ml
 gen-src/templateEnvMap.mli
 gen-src/templateProgram.ml
@@ -230,20 +232,12 @@ gen-src/transform.ml
 gen-src/transform.mli
 gen-src/typing0.ml
 gen-src/typing0.mli
-gen-src/uint0.ml
-gen-src/uint0.mli
+gen-src/uint63Axioms.ml
+gen-src/uint63Axioms.mli
 gen-src/universes0.ml
 gen-src/universes0.mli
 gen-src/wf.ml
 gen-src/wf.mli
-gen-src/zArith_dec.ml
-gen-src/zArith_dec.mli
-gen-src/zbool.ml
-gen-src/zbool.mli
-gen-src/zeven.ml
-gen-src/zeven.mli
-gen-src/zpower.ml
-gen-src/zpower.mli
 
 gen-src/metacoq_template_plugin.mlpack
 
diff --git a/template-coq/gen-src/metacoq_template_plugin.mlpack b/template-coq/gen-src/metacoq_template_plugin.mlpack
index 43f9a253d..394134ce8 100644
--- a/template-coq/gen-src/metacoq_template_plugin.mlpack
+++ b/template-coq/gen-src/metacoq_template_plugin.mlpack
@@ -7,6 +7,7 @@ Hexadecimal
 Numeral0
 Nat0
 Caml_nat
+ListDef
 List0
 PeanoNat
 Specif
@@ -14,9 +15,13 @@ Basics
 BinPosDef
 BinNums
 BinPos
+PosDef
 BinNat
+NatDef
 BinInt
+IntDef
 PrimInt63
+Uint63Axioms
 Uint0
 Int63
 Byte
@@ -77,6 +82,7 @@ FloatOps
 PrimString
 PrimStringAxioms
 MCString
+Sint63Axioms
 Sint63
 Show
 MCUtils
diff --git a/template-coq/gen-src/specFloat.ml.orig b/template-coq/gen-src/specFloat.ml.orig
index 612fa74ed..010415afd 100644
--- a/template-coq/gen-src/specFloat.ml.orig
+++ b/template-coq/gen-src/specFloat.ml.orig
@@ -1,10 +1,7 @@
-open BinInt
 open BinNums
-open BinPos
-open Bool
 open Datatypes
-open Zbool
-open Zpower
+open IntDef
+open PosDef
 
 type spec_float =
 | S754_zero of bool
@@ -39,7 +36,7 @@ let coq_Zdigits2 n = match n with
 (** val canonical_mantissa : coq_Z -> coq_Z -> positive -> coq_Z -> bool **)
 
 let canonical_mantissa prec emax m e =
-  coq_Zeq_bool (fexp prec emax (Z.add (Zpos (digits2_pos m)) e)) e
+  Z.eqb (fexp prec emax (Z.add (Zpos (digits2_pos m)) e)) e
 
 (** val bounded : coq_Z -> coq_Z -> positive -> coq_Z -> bool **)
 
@@ -174,7 +171,7 @@ let binary_round_aux prec emax sx mx ex lx =
 
 let shl_align mx ex ex' =
   match Z.sub ex' ex with
-  | Zneg d -> ((shift_pos d mx), ex')
+  | Zneg d -> ((Pos.iter (fun x -> Coq_xO x) mx d), ex')
   | _ -> (mx, ex)
 
 (** val binary_round :
@@ -283,8 +280,8 @@ let coq_SFclassify prec = function
 | S754_nan -> NaN
 | S754_finite (s, m, _) ->
   if s
-  then if Pos.eqb (digits2_pos m) (Z.to_pos prec) then NNormal else NSubn
-  else if Pos.eqb (digits2_pos m) (Z.to_pos prec) then PNormal else PSubn
+  then if Z.eqb (Zpos (digits2_pos m)) prec then NNormal else NSubn
+  else if Z.eqb (Zpos (digits2_pos m)) prec then PNormal else PSubn
 
 (** val coq_SFmul :
     coq_Z -> coq_Z -> spec_float -> spec_float -> spec_float **)
@@ -323,12 +320,16 @@ let coq_SFadd prec emax x y =
   match x with
   | S754_zero sx ->
     (match y with
-     | S754_zero sy -> if eqb sx sy then x else S754_zero false
+     | S754_zero sy ->
+       if sx
+       then if sy then x else S754_zero false
+       else if sy then S754_zero false else x
      | S754_nan -> S754_nan
      | _ -> y)
   | S754_infinity sx ->
     (match y with
-     | S754_infinity sy -> if eqb sx sy then x else S754_nan
+     | S754_infinity sy ->
+       if sx then if sy then x else S754_nan else if sy then S754_nan else x
      | S754_nan -> S754_nan
      | _ -> x)
   | S754_nan -> S754_nan
@@ -341,7 +342,8 @@ let coq_SFadd prec emax x y =
        let ez = Z.min ex ey in
        binary_normalize prec emax
          (Z.add (cond_Zopp sx (Zpos (fst (shl_align mx ex ez))))
-           (cond_Zopp sy (Zpos (fst (shl_align my ey ez))))) ez false)
+           (cond_Zopp sy (Zpos (fst (shl_align my ey ez)))))
+         ez false)
 
 (** val coq_SFsub :
     coq_Z -> coq_Z -> spec_float -> spec_float -> spec_float **)
@@ -350,13 +352,17 @@ let coq_SFsub prec emax x y =
   match x with
   | S754_zero sx ->
     (match y with
-     | S754_zero sy -> if eqb sx (negb sy) then x else S754_zero false
+     | S754_zero sy ->
+       if sx
+       then if sy then S754_zero false else x
+       else if sy then x else S754_zero false
      | S754_infinity sy -> S754_infinity (negb sy)
      | S754_nan -> S754_nan
      | S754_finite (sy, my, ey) -> S754_finite ((negb sy), my, ey))
   | S754_infinity sx ->
     (match y with
-     | S754_infinity sy -> if eqb sx (negb sy) then x else S754_nan
+     | S754_infinity sy ->
+       if sx then if sy then S754_nan else x else if sy then x else S754_nan
      | S754_nan -> S754_nan
      | _ -> x)
   | S754_nan -> S754_nan
@@ -369,19 +375,20 @@ let coq_SFsub prec emax x y =
        let ez = Z.min ex ey in
        binary_normalize prec emax
          (Z.sub (cond_Zopp sx (Zpos (fst (shl_align mx ex ez))))
-           (cond_Zopp sy (Zpos (fst (shl_align my ey ez))))) ez false)
+           (cond_Zopp sy (Zpos (fst (shl_align my ey ez)))))
+         ez false)
 
 (** val new_location_even : coq_Z -> coq_Z -> location **)
 
 let new_location_even nb_steps k =
-  if coq_Zeq_bool k Z0
+  if Z.eqb k Z0
   then Coq_loc_Exact
   else Coq_loc_Inexact (Z.compare (Z.mul (Zpos (Coq_xO Coq_xH)) k) nb_steps)
 
 (** val new_location_odd : coq_Z -> coq_Z -> location **)
 
 let new_location_odd nb_steps k =
-  if coq_Zeq_bool k Z0
+  if Z.eqb k Z0
   then Coq_loc_Exact
   else Coq_loc_Inexact
          (match Z.compare
@@ -456,7 +463,7 @@ let coq_SFsqrt_core_binary prec emax m e =
            | Zneg _ -> Z0 in
   let (q, r) = Z.sqrtrem m' in
   let l =
-    if coq_Zeq_bool r Z0
+    if Z.eqb r Z0
     then Coq_loc_Exact
     else Coq_loc_Inexact (if Z.leb r q then Lt else Gt)
   in
@@ -491,11 +498,11 @@ let coq_SFldexp prec emax f e =
 
 let coq_SFfrexp prec emax f = match f with
 | S754_finite (sx, mx, ex) ->
-  if Pos.leb (Z.to_pos prec) (digits2_pos mx)
+  if Z.leb prec (Zpos (digits2_pos mx))
   then ((S754_finite (sx, mx, (Z.opp prec))), (Z.add ex prec))
   else let d = Z.sub prec (Zpos (digits2_pos mx)) in
-       ((S754_finite (sx, (shift_pos (Z.to_pos d) mx), (Z.opp prec))),
-       (Z.sub (Z.add ex prec) d))
+       ((S754_finite (sx, (Pos.iter (fun x -> Coq_xO x) mx (Z.to_pos d)),
+       (Z.opp prec))), (Z.sub (Z.add ex prec) d))
 | _ -> (f, (Z.sub (Z.mul (Zneg (Coq_xO Coq_xH)) emax) prec))
 
 (** val coq_SFone : coq_Z -> coq_Z -> spec_float **)
@@ -514,7 +521,8 @@ let coq_SFulp prec emax x =
 let coq_SFpred_pos prec emax x = match x with
 | S754_finite (_, mx, _) ->
   let d =
-    if Pos.eqb (Coq_xO mx) (shift_pos (Z.to_pos prec) Coq_xH)
+    if Pos.eqb (Coq_xO mx)
+         (Pos.iter (fun x0 -> Coq_xO x0) Coq_xH (Z.to_pos prec))
     then coq_SFldexp prec emax (coq_SFone prec emax)
            (fexp prec emax
              (Z.sub (snd (coq_SFfrexp prec emax x)) (Zpos Coq_xH)))
@@ -526,7 +534,8 @@ let coq_SFpred_pos prec emax x = match x with
 (** val coq_SFmax_float : coq_Z -> coq_Z -> spec_float **)
 
 let coq_SFmax_float prec emax =
-  S754_finite (false, (Pos.sub (shift_pos (Z.to_pos prec) Coq_xH) Coq_xH),
+  S754_finite (false,
+    (Pos.sub (Pos.iter (fun x -> Coq_xO x) Coq_xH (Z.to_pos prec)) Coq_xH),
     (Z.sub emax prec))
 
 (** val coq_SFsucc : coq_Z -> coq_Z -> spec_float -> spec_float **)
diff --git a/template-coq/specFloat.patch b/template-coq/specFloat.patch
index 294627074..f485afd40 100644
--- a/template-coq/specFloat.patch
+++ b/template-coq/specFloat.patch
@@ -2,8 +2,8 @@
 +++ gen-src/specFloat.ml	2020-12-04 21:48:33.000000000 +0100
 @@ -4,6 +4,7 @@
  open Datatypes
- open Zbool
- open Zpower
+ open IntDef
+ open PosDef
 +open Float64
  
  type spec_float =
diff --git a/template-coq/src/ast_denoter.ml b/template-coq/src/ast_denoter.ml
index 4accda36a..f31e38694 100644
--- a/template-coq/src/ast_denoter.ml
+++ b/template-coq/src/ast_denoter.ml
@@ -232,7 +232,7 @@ struct
   let unquote_universe_level evm l = evm, unquote_level l
 
   let unquote_universe_instance(evm: Evd.evar_map) (l: quoted_univ_instance): Evd.evar_map * UVars.Instance.t
-  = (evm,  UVars.Instance.of_array ([||], Array.of_list (List0.map unquote_level l)))
+  = (evm,  UVars.Instance.of_array ([||], Array.of_list (List.map unquote_level l)))
 
 
   let unquote_global_reference (trm : Kernames.global_reference) : GlobRef.t =
diff --git a/template-coq/theories/Constants.v b/template-coq/theories/Constants.v
index a8ea5dd3e..a99f6e90d 100644
--- a/template-coq/theories/Constants.v
+++ b/template-coq/theories/Constants.v
@@ -9,49 +9,49 @@ Register bytestring.String.t as metacoq.string.type.
 Register bytestring.String.EmptyString as metacoq.string.nil.
 Register bytestring.String.String as metacoq.string.cons.
 
-Register Stdlib.Init.Byte.byte as metacoq.byte.type.
+Register Corelib.Init.Byte.byte as metacoq.byte.type.
 
-Register Stdlib.Init.Datatypes.nat as metacoq.nat.type.
-Register Stdlib.Init.Datatypes.O as metacoq.nat.zero.
-Register Stdlib.Init.Datatypes.S as metacoq.nat.succ.
+Register Corelib.Init.Datatypes.nat as metacoq.nat.type.
+Register Corelib.Init.Datatypes.O as metacoq.nat.zero.
+Register Corelib.Init.Datatypes.S as metacoq.nat.succ.
 
-Register Stdlib.Init.Datatypes.bool as metacoq.bool.type.
-Register Stdlib.Init.Datatypes.true as metacoq.bool.true.
-Register Stdlib.Init.Datatypes.false as metacoq.bool.false.
+Register Corelib.Init.Datatypes.bool as metacoq.bool.type.
+Register Corelib.Init.Datatypes.true as metacoq.bool.true.
+Register Corelib.Init.Datatypes.false as metacoq.bool.false.
 
-Register Stdlib.Init.Datatypes.option as metacoq.option.type.
-Register Stdlib.Init.Datatypes.None as metacoq.option.none.
-Register Stdlib.Init.Datatypes.Some as metacoq.option.some.
+Register Corelib.Init.Datatypes.option as metacoq.option.type.
+Register Corelib.Init.Datatypes.None as metacoq.option.none.
+Register Corelib.Init.Datatypes.Some as metacoq.option.some.
 Register MetaCoq.Template.TemplateMonad.Common.my_None as metacoq.option_instance.none.
 Register MetaCoq.Template.TemplateMonad.Common.my_Some as metacoq.option_instance.some.
 
-Register Stdlib.Init.Datatypes.list as metacoq.list.type.
-Register Stdlib.Init.Datatypes.nil as metacoq.list.nil.
-Register Stdlib.Init.Datatypes.cons as metacoq.list.cons.
+Register Corelib.Init.Datatypes.list as metacoq.list.type.
+Register Corelib.Init.Datatypes.nil as metacoq.list.nil.
+Register Corelib.Init.Datatypes.cons as metacoq.list.cons.
 
-Register Stdlib.Init.Datatypes.prod as metacoq.prod.type.
-Register Stdlib.Init.Datatypes.pair as metacoq.prod.intro.
+Register Corelib.Init.Datatypes.prod as metacoq.prod.type.
+Register Corelib.Init.Datatypes.pair as metacoq.prod.intro.
 
-Register Stdlib.Init.Datatypes.sum as metacoq.sum.type.
-Register Stdlib.Init.Datatypes.inl as metacoq.sum.inl.
-Register Stdlib.Init.Datatypes.inr as metacoq.sum.inr.
+Register Corelib.Init.Datatypes.sum as metacoq.sum.type.
+Register Corelib.Init.Datatypes.inl as metacoq.sum.inl.
+Register Corelib.Init.Datatypes.inr as metacoq.sum.inr.
 
-Register Stdlib.Init.Datatypes.unit as metacoq.unit.type.
-Register Stdlib.Init.Datatypes.tt as metacoq.unit.intro.
+Register Corelib.Init.Datatypes.unit as metacoq.unit.type.
+Register Corelib.Init.Datatypes.tt as metacoq.unit.intro.
 
-Register Stdlib.Init.Specif.sigT as metacoq.sigma.type.
-Register Stdlib.Init.Specif.existT as metacoq.sigma.intro.
+Register Corelib.Init.Specif.sigT as metacoq.sigma.type.
+Register Corelib.Init.Specif.existT as metacoq.sigma.intro.
 Register MetaCoq.Template.TemplateMonad.Common.existT_typed_term as metacoq.sigma.typed_term.
 
-Register Stdlib.Numbers.BinNums.positive as metacoq.pos.type.
-Register Stdlib.Numbers.BinNums.xI as metacoq.pos.xI.
-Register Stdlib.Numbers.BinNums.xO as metacoq.pos.xO.
-Register Stdlib.Numbers.BinNums.xH as metacoq.pos.xH.
+Register BinNums.positive as metacoq.pos.type.
+Register BinNums.xI as metacoq.pos.xI.
+Register BinNums.xO as metacoq.pos.xO.
+Register BinNums.xH as metacoq.pos.xH.
 
-Register Stdlib.Numbers.BinNums.Z as metacoq.Z.type.
-Register Stdlib.Numbers.BinNums.Zpos as metacoq.Z.pos.
-Register Stdlib.Numbers.BinNums.Zneg as metacoq.Z.neg.
-Register Stdlib.Numbers.BinNums.Z0 as metacoq.Z.zero.
+Register BinNums.Z as metacoq.Z.type.
+Register BinNums.Zpos as metacoq.Z.pos.
+Register BinNums.Zneg as metacoq.Z.neg.
+Register BinNums.Z0 as metacoq.Z.zero.
 
 (* Ast *)
 Register MetaCoq.Common.BasicAst.relevance as metacoq.ast.relevance.
diff --git a/template-pcuic/metacoq-config b/template-pcuic/metacoq-config
index 00bfe61cd..7fe94ce25 100644
--- a/template-pcuic/metacoq-config
+++ b/template-pcuic/metacoq-config
@@ -1,2 +1,2 @@
 # DO NOT EDIT THIS FILE: autogenerated from ./configure.sh
--R ../utils/theories MetaCoq.Utils -R ../common/theories MetaCoq.Common -R ../pcuic/theories MetaCoq.PCUIC -R ../template-coq/theories MetaCoq.Template -I ../template-coq
+
diff --git a/test-suite/extractable.v b/test-suite/extractable.v
index e985c583a..384fa96a6 100644
--- a/test-suite/extractable.v
+++ b/test-suite/extractable.v
@@ -50,7 +50,7 @@ Print blah0.
 
 MetaCoq Test Quote nat.
 MetaCoq Run
-    (tmBind (tmQuoteInductive (MPfile ["Datatypes"; "Init"; "Stdlib"], "nat"))
+    (tmBind (tmQuoteInductive (MPfile ["Datatypes"; "Init"; "Corelib"], "nat"))
             (fun mi => tmMsg (string_of_nat (length mi.(ind_bodies))))).
 
 Definition nAnon := {| binder_name := nAnon; binder_relevance := Relevant |}.
@@ -77,6 +77,6 @@ MetaCoq Run
             (fun s => tmMsg (string_of_modpath s))).
 
 MetaCoq Test Quote plus.
-MetaCoq Run (tmQuoteInductive (MPfile ["Datatypes"; "Init"; "Stdlib"], "nat")).
+MetaCoq Run (tmQuoteInductive (MPfile ["Datatypes"; "Init"; "Corelib"], "nat")).
 
-MetaCoq Run (tmQuoteConstant (MPfile ["Nat"; "Init"; "Stdlib"], "add") true).
+MetaCoq Run (tmQuoteConstant (MPfile ["Nat"; "Init"; "Corelib"], "add") true).
diff --git a/test-suite/modules_sections.v b/test-suite/modules_sections.v
index 131c4ecf1..305d26ae7 100644
--- a/test-suite/modules_sections.v
+++ b/test-suite/modules_sections.v
@@ -79,9 +79,9 @@ MetaCoq Run (bc <- tmQuote S.b ;;
 
 MetaCoq Test Quote my_projT2.
 MetaCoq Test Unquote
-     (Ast.tConstruct (mkInd (MPfile ["Datatypes"; "Init"; "Stdlib"], "nat") 0) 0 []).
+     (Ast.tConstruct (mkInd (MPfile ["Datatypes"; "Init"; "Corelib"], "nat") 0) 0 []).
 MetaCoq Unquote Definition zero_from_syntax
-  := (Ast.tConstruct (mkInd (MPfile ["Datatypes"; "Init"; "Stdlib"], "nat") 0) 0 []).
+  := (Ast.tConstruct (mkInd (MPfile ["Datatypes"; "Init"; "Corelib"], "nat") 0) 0 []).
 
 Existing Class nat.
 
diff --git a/test-suite/proj.v b/test-suite/proj.v
index 61b862ace..27efd8bde 100644
--- a/test-suite/proj.v
+++ b/test-suite/proj.v
@@ -43,8 +43,8 @@ Import ListNotations.
 
 
 Definition qprod' := mkInd (MPfile ["proj"; "TestSuite"; "MetaCoq"], "prod'") 0.
-Definition qnat := mkInd (MPfile ["Datatypes"; "Init"; "Stdlib"], "nat") 0.
-Definition qbool := mkInd (MPfile ["Datatypes"; "Init"; "Stdlib"], "bool") 0.
+Definition qnat := mkInd (MPfile ["Datatypes"; "Init"; "Corelib"], "nat") 0.
+Definition qbool := mkInd (MPfile ["Datatypes"; "Init"; "Corelib"], "bool") 0.
 
 MetaCoq Unquote Definition x := (tProj (mkProjection qprod' 2 1)
    (tApp (tConstruct qprod' 0 nil)
diff --git a/test-suite/safechecker_test.v b/test-suite/safechecker_test.v
index 542cec8e2..44cc847d0 100644
--- a/test-suite/safechecker_test.v
+++ b/test-suite/safechecker_test.v
@@ -12,7 +12,8 @@ Environment is well-formed and Ind(Stdlib.Init.Datatypes.nat,0,[]) has type: Sor
 MetaCoq SafeCheck (3 + 1).
 
 Definition bool_list := List.map negb (cons true (cons false nil)).
-MetaCoq SafeCheck bool_list.
+(* was working a bit by accident *)
+(* MetaCoq SafeCheck bool_list. *)
 MetaCoq CoqCheck bool_list.
 
 (* Time MetaCoq SafeCheck @infer_and_print_template_program. *)
diff --git a/test-suite/unfold.v b/test-suite/unfold.v
index 97474e5a3..7d1d339d5 100644
--- a/test-suite/unfold.v
+++ b/test-suite/unfold.v
@@ -3,4 +3,4 @@ From MetaCoq.Template Require Import All.
 Import MCMonadNotation.
 
 MetaCoq Test Quote negb.
-MetaCoq Run (tmBind (tmEval (unfold (MPfile ["Datatypes"; "Init"; "Stdlib"], "negb")) negb) tmPrint).
+MetaCoq Run (tmBind (tmEval (unfold (MPfile ["Datatypes"; "Init"; "Corelib"], "negb")) negb) tmPrint).
diff --git a/translations/MiniHoTT.v b/translations/MiniHoTT.v
index c3c8e6b45..3b25d7d2b 100644
--- a/translations/MiniHoTT.v
+++ b/translations/MiniHoTT.v
@@ -64,7 +64,7 @@ Arguments symmetry {A R _} / _ _ _.
 Arguments transitivity {A R _} / {_ _ _} _ _.
 
 Ltac reflexivity :=
-  Stdlib.Init.Ltac.reflexivity
+  Corelib.Init.Ltac.reflexivity
   || (intros;
       let R := match goal with |- ?R ?x ?y => constr:(R) end in
       let pre_proof_term_head := constr:(@reflexivity _ R _) in
diff --git a/translations/MiniHoTT_paths.v b/translations/MiniHoTT_paths.v
index 514994817..3b97012dd 100644
--- a/translations/MiniHoTT_paths.v
+++ b/translations/MiniHoTT_paths.v
@@ -67,7 +67,7 @@ Arguments symmetry {A R _} / _ _ _.
 Arguments transitivity {A R _} / {_ _ _} _ _.
 
 Ltac reflexivity :=
-  Stdlib.Init.Ltac.reflexivity
+  Corelib.Init.Ltac.reflexivity
   || (intros;
       let R := match goal with |- ?R ?x ?y => constr:(R) end in
       let pre_proof_term_head := constr:(@reflexivity _ R _) in
diff --git a/utils/theories/bytestring.v b/utils/theories/bytestring.v
index ad0f13089..a0b6ea0cf 100644
--- a/utils/theories/bytestring.v
+++ b/utils/theories/bytestring.v
@@ -9,7 +9,7 @@
 Require Coq.Strings.String ssrbool.
 Require Import ssreflect.
 Require Import Coq.NArith.NArith.
-Require Import Coq.micromega.Lia.
+From Coq Require Import Lia.
 From Equations Require Import Equations.
 Set Primitive Projections.
 Set Default Proof Using "Type".
@@ -196,7 +196,7 @@ Notation "x ++ y" := (String.append x y) : bs_scope.
 Import String.
 
 (** comparison *)
-Require Import Orders Coq.Structures.OrderedType Coq.Structures.OrdersAlt.
+From Coq Require Import Orders OrderedType OrdersAlt.
 
 Lemma to_N_inj : forall x y, Byte.to_N x = Byte.to_N y <-> x = y.
 Proof.