diff --git a/tutorial/c++/t10.cpp b/tutorial/c++/t10.cpp
index d7b5477726e3771fd677cb27bba719694f44c8cc..d4a2705c1ec56d760139bc7c4bc26f6e54835bc4 100644
--- a/tutorial/c++/t10.cpp
+++ b/tutorial/c++/t10.cpp
@@ -13,43 +13,40 @@
 #include <gmsh.h>
 #include <sstream>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize(argc, argv);
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t10");
+  gmsh::model::add("t10");
 
   // Let's create a simple rectangular geometry:
   double lc = .15;
-  factory::addPoint(0.0,0.0,0,lc, 1);
-  factory::addPoint(1,0.0,0,lc, 2);
-  factory::addPoint(1,1,0,lc, 3);
-  factory::addPoint(0,1,0,lc, 4);
-  factory::addPoint(0.2,.5,0,lc, 5);
+  gmsh::model::geo::addPoint(0.0,0.0,0,lc, 1);
+  gmsh::model::geo::addPoint(1,0.0,0,lc, 2);
+  gmsh::model::geo::addPoint(1,1,0,lc, 3);
+  gmsh::model::geo::addPoint(0,1,0,lc, 4);
+  gmsh::model::geo::addPoint(0.2,.5,0,lc, 5);
 
-  factory::addLine(1,2, 1);
-  factory::addLine(2,3, 2);
-  factory::addLine(3,4, 3);
-  factory::addLine(4,1, 4);
+  gmsh::model::geo::addLine(1,2, 1);
+  gmsh::model::geo::addLine(2,3, 2);
+  gmsh::model::geo::addLine(3,4, 3);
+  gmsh::model::geo::addLine(4,1, 4);
 
-  factory::addCurveLoop({1,2,3,4}, 5);
-  factory::addPlaneSurface({5}, 6);
+  gmsh::model::geo::addCurveLoop({1,2,3,4}, 5);
+  gmsh::model::geo::addPlaneSurface({5}, 6);
 
-  factory::synchronize();
+  gmsh::model::geo::synchronize();
 
   // Say we would like to obtain mesh elements with size lc/30 near curve 2 and
   // point 5, and size lc elsewhere. To achieve this, we can use two fields:
   // "Distance", and "Threshold". We first define a Distance field (`Field[1]')
   // on points 5 and on curve 2. This field returns the distance to point 5 and
   // to (100 equidistant points on) curve 2.
-  model::mesh::field::add("Distance", 1);
-  model::mesh::field::setNumbers(1, "NodesList", {5});
-  model::mesh::field::setNumber(1, "NNodesByEdge", 100);
-  model::mesh::field::setNumbers(1, "EdgesList", {2});
+  gmsh::model::mesh::field::add("Distance", 1);
+  gmsh::model::mesh::field::setNumbers(1, "NodesList", {5});
+  gmsh::model::mesh::field::setNumber(1, "NNodesByEdge", 100);
+  gmsh::model::mesh::field::setNumbers(1, "EdgesList", {2});
 
   // We then define a `Threshold' field, which uses the return value of the
   // `Distance' field 1 in order to define a simple change in element size
@@ -62,41 +59,42 @@ int main(int argc, char **argv)
   // LcMin -o----------------/
   //        |                |       |
   //      Point           DistMin DistMax
-  model::mesh::field::add("Threshold", 2);
-  model::mesh::field::setNumber(2, "IField", 1);
-  model::mesh::field::setNumber(2, "LcMin", lc / 30);
-  model::mesh::field::setNumber(2, "LcMax", lc);
-  model::mesh::field::setNumber(2, "DistMin", 0.15);
-  model::mesh::field::setNumber(2, "DistMax", 0.5);
+  gmsh::model::mesh::field::add("Threshold", 2);
+  gmsh::model::mesh::field::setNumber(2, "IField", 1);
+  gmsh::model::mesh::field::setNumber(2, "LcMin", lc / 30);
+  gmsh::model::mesh::field::setNumber(2, "LcMax", lc);
+  gmsh::model::mesh::field::setNumber(2, "DistMin", 0.15);
+  gmsh::model::mesh::field::setNumber(2, "DistMax", 0.5);
 
   // Say we want to modulate the mesh element sizes using a mathematical
   // function of the spatial coordinates. We can do this with the MathEval
   // field:
-  model::mesh::field::add("MathEval", 3);
-  model::mesh::field::setString(3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101");
+  gmsh::model::mesh::field::add("MathEval", 3);
+  gmsh::model::mesh::field::setString
+    (3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101");
 
   // We could also combine MathEval with values coming from other fields. For
   // example, let's define a `Distance' field around point 1
-  model::mesh::field::add("Distance", 4);
-  model::mesh::field::setNumbers(4, "NodesList", {1});
+  gmsh::model::mesh::field::add("Distance", 4);
+  gmsh::model::mesh::field::setNumbers(4, "NodesList", {1});
 
   // We can then create a `MathEval' field with a function that depends on the
   // return value of the `Distance' field 4, i.e., depending on the distance to
   // point 1 (here using a cubic law, with minimum element size = lc / 100)
-  model::mesh::field::add("MathEval", 5);
+  gmsh::model::mesh::field::add("MathEval", 5);
   std::stringstream stream;
   stream << "F4^3 + " << lc / 100;
-  model::mesh::field::setString(5, "F", stream.str());
+  gmsh::model::mesh::field::setString(5, "F", stream.str());
 
   // We could also use a `Box' field to impose a step change in element sizes
   // inside a box
-  model::mesh::field::add("Box", 6);
-  model::mesh::field::setNumber(6, "VIn", lc / 15);
-  model::mesh::field::setNumber(6, "VOut", lc);
-  model::mesh::field::setNumber(6, "XMin", 0.3);
-  model::mesh::field::setNumber(6, "XMax", 0.6);
-  model::mesh::field::setNumber(6, "YMin", 0.3);
-  model::mesh::field::setNumber(6, "YMax", 0.6);
+  gmsh::model::mesh::field::add("Box", 6);
+  gmsh::model::mesh::field::setNumber(6, "VIn", lc / 15);
+  gmsh::model::mesh::field::setNumber(6, "VOut", lc);
+  gmsh::model::mesh::field::setNumber(6, "XMin", 0.3);
+  gmsh::model::mesh::field::setNumber(6, "XMax", 0.6);
+  gmsh::model::mesh::field::setNumber(6, "YMin", 0.3);
+  gmsh::model::mesh::field::setNumber(6, "YMax", 0.6);
 
   // Many other types of fields are available: see the reference manual for a
   // complete list. You can also create fields directly in the graphical user
@@ -104,10 +102,10 @@ int main(int argc, char **argv)
 
   // Finally, let's use the minimum of all the fields as the background mesh
   // field:
-  model::mesh::field::add("Min", 7);
-  model::mesh::field::setNumbers(7, "FieldsList", {2, 3, 5, 6});
+  gmsh::model::mesh::field::add("Min", 7);
+  gmsh::model::mesh::field::setNumbers(7, "FieldsList", {2, 3, 5, 6});
 
-  model::mesh::field::setAsBackgroundMesh(7);
+  gmsh::model::mesh::field::setAsBackgroundMesh(7);
 
   // To determine the size of mesh elements, Gmsh locally computes the minimum
   // of
@@ -137,7 +135,7 @@ int main(int argc, char **argv)
 
   // This will prevent over-refinement due to small mesh sizes on the boundary.
 
-  model::mesh::generate(2);
+  gmsh::model::mesh::generate(2);
   gmsh::write("t10.msh");
 
   // gmsh::fltk::run();
diff --git a/tutorial/c++/t12.cpp b/tutorial/c++/t12.cpp
index 79d98f38a1da98307064d368fa2fc8ca0dcb89f5..9edc3924259f3cc7c5a9c7ccce939a6e09ed6252 100644
--- a/tutorial/c++/t12.cpp
+++ b/tutorial/c++/t12.cpp
@@ -8,8 +8,6 @@
 
 #include <gmsh.h>
 
-namespace factory = gmsh::model::geo;
-
 // "Compound" meshing constraints allow to generate meshes across surface
 // boundaries, which can be useful e.g. for imported CAD models (e.g. STEP) with
 // undesired small features.
@@ -48,37 +46,37 @@ int main(int argc, char **argv)
 
   double lc = 0.1;
 
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(1, 0, 0, lc, 2);
-  factory::addPoint(1, 1, 0.5, lc, 3);
-  factory::addPoint(0, 1, 0.4, lc, 4);
-  factory::addPoint(0.3, 0.2, 0, lc, 5);
-  factory::addPoint(0, 0.01, 0.01, lc, 6);
-  factory::addPoint(0, 0.02, 0.02, lc, 7);
-  factory::addPoint(1, 0.05, 0.02, lc, 8);
-  factory::addPoint(1, 0.32, 0.02, lc, 9);
-
-  factory::addLine(1, 2, 1);
-  factory::addLine(2, 8, 2);
-  factory::addLine(8, 9, 3);
-  factory::addLine(9, 3, 4);
-  factory::addLine(3, 4, 5);
-  factory::addLine(4, 7, 6);
-  factory::addLine(7, 6, 7);
-  factory::addLine(6, 1, 8);
-  factory::addSpline({7, 5, 9}, 9);
-  factory::addLine(6, 8, 10);
-
-  factory::addCurveLoop({5, 6, 9, 4}, 11);
-  factory::addSurfaceFilling({11}, 1);
-
-  factory::addCurveLoop({-9, 3, 10, 7}, 13);
-  factory::addSurfaceFilling({13}, 5);
-
-  factory::addCurveLoop({-10, 2, 1, 8}, 15);
-  factory::addSurfaceFilling({15}, 10);
-
-  factory::synchronize();
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(1, 0, 0, lc, 2);
+  gmsh::model::geo::addPoint(1, 1, 0.5, lc, 3);
+  gmsh::model::geo::addPoint(0, 1, 0.4, lc, 4);
+  gmsh::model::geo::addPoint(0.3, 0.2, 0, lc, 5);
+  gmsh::model::geo::addPoint(0, 0.01, 0.01, lc, 6);
+  gmsh::model::geo::addPoint(0, 0.02, 0.02, lc, 7);
+  gmsh::model::geo::addPoint(1, 0.05, 0.02, lc, 8);
+  gmsh::model::geo::addPoint(1, 0.32, 0.02, lc, 9);
+
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(2, 8, 2);
+  gmsh::model::geo::addLine(8, 9, 3);
+  gmsh::model::geo::addLine(9, 3, 4);
+  gmsh::model::geo::addLine(3, 4, 5);
+  gmsh::model::geo::addLine(4, 7, 6);
+  gmsh::model::geo::addLine(7, 6, 7);
+  gmsh::model::geo::addLine(6, 1, 8);
+  gmsh::model::geo::addSpline({7, 5, 9}, 9);
+  gmsh::model::geo::addLine(6, 8, 10);
+
+  gmsh::model::geo::addCurveLoop({5, 6, 9, 4}, 11);
+  gmsh::model::geo::addSurfaceFilling({11}, 1);
+
+  gmsh::model::geo::addCurveLoop({-9, 3, 10, 7}, 13);
+  gmsh::model::geo::addSurfaceFilling({13}, 5);
+
+  gmsh::model::geo::addCurveLoop({-10, 2, 1, 8}, 15);
+  gmsh::model::geo::addSurfaceFilling({15}, 10);
+
+  gmsh::model::geo::synchronize();
 
   // Treat curves 2, 3 and 4 as a single curve when meshing (i.e. mesh across
   // points 6 and 7)
@@ -91,6 +89,11 @@ int main(int argc, char **argv)
   // across curves 9 and 10)
   gmsh::model::mesh::setCompound(2, {1, 5, 10});
 
+  gmsh::model::mesh::generate(2);
+  gmsh::write("t12.msh");
+
+  // gmsh::fltk::run();
+
   gmsh::finalize();
 
   return 0;
diff --git a/tutorial/c++/t13.cpp b/tutorial/c++/t13.cpp
index d85b266e58e0f0916f8a38065de487c25598177e..56bdac7f140dd972d701a6e13591316752ee395b 100644
--- a/tutorial/c++/t13.cpp
+++ b/tutorial/c++/t13.cpp
@@ -9,8 +9,6 @@
 #include <gmsh.h>
 #include <math.h>
 
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize();
diff --git a/tutorial/c++/t14.cpp b/tutorial/c++/t14.cpp
index 2118e52ee5133851384116c8a7937f15c788f273..beba240d1b8dc7c347fdb3aaa4252a573a589e81 100644
--- a/tutorial/c++/t14.cpp
+++ b/tutorial/c++/t14.cpp
@@ -14,8 +14,6 @@
 #include <math.h>
 #include <algorithm>
 
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize(argc, argv);
diff --git a/tutorial/c++/t15.cpp b/tutorial/c++/t15.cpp
index 9b40ea9039f4aade3787a4d4bf9c543ffa28abeb..f6c86df21250efc71457287b4c43d2a966e9eeb9 100644
--- a/tutorial/c++/t15.cpp
+++ b/tutorial/c++/t15.cpp
@@ -16,9 +16,6 @@
 
 #include <gmsh.h>
 
-namespace factory = gmsh::model::geo;
-namespace model = gmsh::model;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize();
@@ -28,72 +25,72 @@ int main(int argc, char **argv)
 
   // Copied from t1.cpp:
   double lc = 1e-2;
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(.1, 0,  0, lc, 2);
-  factory::addPoint(.1, .3, 0, lc, 3);
-  factory::addPoint(0,  .3, 0, lc, 4);
-  factory::addLine(1, 2, 1);
-  factory::addLine(3, 2, 2);
-  factory::addLine(3, 4, 3);
-  factory::addLine(4, 1, 4);
-  factory::addCurveLoop({4, 1, -2, 3}, 1);
-  factory::addPlaneSurface({1}, 1);
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(.1, 0,  0, lc, 2);
+  gmsh::model::geo::addPoint(.1, .3, 0, lc, 3);
+  gmsh::model::geo::addPoint(0,  .3, 0, lc, 4);
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(3, 2, 2);
+  gmsh::model::geo::addLine(3, 4, 3);
+  gmsh::model::geo::addLine(4, 1, 4);
+  gmsh::model::geo::addCurveLoop({4, 1, -2, 3}, 1);
+  gmsh::model::geo::addPlaneSurface({1}, 1);
 
   // We change the mesh size to generate a coarser mesh
   lc *=  4;
-  factory::mesh::setSize({{0, 1}, {0, 2}, {0, 3}, {0, 4}}, lc);
+  gmsh::model::geo::mesh::setSize({{0, 1}, {0, 2}, {0, 3}, {0, 4}}, lc);
 
   // We define a new point
-  factory::addPoint(0.02, 0.02, 0., lc, 5);
+  gmsh::model::geo::addPoint(0.02, 0.02, 0., lc, 5);
 
   // We have to synchronize before embedding entites:
-  factory::synchronize();
+  gmsh::model::geo::synchronize();
 
   // One can force this point to be included ("embedded") in the 2D mesh, using
   // the `embed()' function:
-  model::mesh::embed(0, {5}, 2, 1);
+  gmsh::model::mesh::embed(0, {5}, 2, 1);
 
   // In the same way, one use `embed()' to force a curve to be embedded in the
   // 2D mesh:
-  factory::addPoint(0.02, 0.12, 0., lc, 6);
-  factory::addPoint(0.04, 0.18, 0., lc, 7);
-  factory::addLine(6, 7, 5);
-  factory::synchronize();
-  model::mesh::embed(1, {5}, 2, 1);
+  gmsh::model::geo::addPoint(0.02, 0.12, 0., lc, 6);
+  gmsh::model::geo::addPoint(0.04, 0.18, 0., lc, 7);
+  gmsh::model::geo::addLine(6, 7, 5);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::embed(1, {5}, 2, 1);
 
   // Points and curves can also be embedded in volumes
   std::vector<std::pair<int, int> > ext;
-  factory::extrude({{2, 1}}, 0, 0, 0.1, ext);
+  gmsh::model::geo::extrude({{2, 1}}, 0, 0, 0.1, ext);
 
-  int p = factory::addPoint(0.07, 0.15, 0.025, lc);
+  int p = gmsh::model::geo::addPoint(0.07, 0.15, 0.025, lc);
 
-  factory::synchronize();
-  model::mesh::embed(0, {p}, 3, 1);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::embed(0, {p}, 3, 1);
 
-  factory::addPoint(0.025, 0.15, 0.025, lc, p+1);
-  int l = factory::addLine(7, p+1);
+  gmsh::model::geo::addPoint(0.025, 0.15, 0.025, lc, p+1);
+  int l = gmsh::model::geo::addLine(7, p+1);
 
-  factory::synchronize();
-  model::mesh::embed(1, {l}, 3, 1);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::embed(1, {l}, 3, 1);
 
   // Finally, we can also embed a surface in a volume:
-  factory::addPoint(0.02, 0.12, 0.05, lc, p+2);
-  factory::addPoint(0.04, 0.12, 0.05, lc, p+3);
-  factory::addPoint(0.04, 0.18, 0.05, lc, p+4);
-  factory::addPoint(0.02, 0.18, 0.05, lc, p+5);
+  gmsh::model::geo::addPoint(0.02, 0.12, 0.05, lc, p+2);
+  gmsh::model::geo::addPoint(0.04, 0.12, 0.05, lc, p+3);
+  gmsh::model::geo::addPoint(0.04, 0.18, 0.05, lc, p+4);
+  gmsh::model::geo::addPoint(0.02, 0.18, 0.05, lc, p+5);
 
-  factory::addLine(p+2, p+3, l+1);
-  factory::addLine(p+3, p+4, l+2);
-  factory::addLine(p+4, p+5, l+3);
-  factory::addLine(p+5, p+2, l+4);
+  gmsh::model::geo::addLine(p+2, p+3, l+1);
+  gmsh::model::geo::addLine(p+3, p+4, l+2);
+  gmsh::model::geo::addLine(p+4, p+5, l+3);
+  gmsh::model::geo::addLine(p+5, p+2, l+4);
 
-  int ll = factory::addCurveLoop({l+1, l+2, l+3, l+4});
-  int s = factory::addPlaneSurface({ll});
+  int ll = gmsh::model::geo::addCurveLoop({l+1, l+2, l+3, l+4});
+  int s = gmsh::model::geo::addPlaneSurface({ll});
 
-  factory::synchronize();
-  model::mesh::embed(2, {s}, 3, 1);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::embed(2, {s}, 3, 1);
 
-  model::mesh::generate(3);
+  gmsh::model::mesh::generate(3);
 
   gmsh::write("t15.msh");
 
diff --git a/tutorial/c++/t16.cpp b/tutorial/c++/t16.cpp
index f4ac56253b2397e8724925cbd49e9b1cadb24646..1255cc7e396d9d26058a93cee5654d423394cf34 100644
--- a/tutorial/c++/t16.cpp
+++ b/tutorial/c++/t16.cpp
@@ -13,15 +13,12 @@
 #include <iostream>
 #include <gmsh.h>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::occ;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize(argc, argv);
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t16");
+  gmsh::model::add("t16");
 
   // Let's build the same model as in `t5.geo', but using constructive solid
   // geometry.
@@ -31,8 +28,8 @@ int main(int argc, char **argv)
 
   // We first create two cubes:
   try {
-    factory::addBox(0,0,0, 1,1,1, 1);
-    factory::addBox(0,0,0, 0.5,0.5,0.5, 2);
+    gmsh::model::occ::addBox(0,0,0, 1,1,1, 1);
+    gmsh::model::occ::addBox(0,0,0, 0.5,0.5,0.5, 2);
   }
   catch(...) {
     gmsh::logger::write("Could not create OpenCASCADE shapes: bye!");
@@ -42,7 +39,7 @@ int main(int argc, char **argv)
   // We apply a boolean difference to create the "cube minus one eigth" shape:
   std::vector<std::pair<int, int> > ov;
   std::vector<std::vector<std::pair<int, int> > > ovv;
-  factory::cut({{3,1}}, {{3,2}}, ov, ovv, 3);
+  gmsh::model::occ::cut({{3,1}}, {{3,2}}, ov, ovv, 3);
 
   // Boolean operations with OpenCASCADE always create new entities. By default
   // the extra arguments `removeObject' and `removeTool' in `cut()' are set to
@@ -54,7 +51,7 @@ int main(int argc, char **argv)
   for(int t = 1; t <= 5; t++){
     x += 0.166 ;
     z += 0.166 ;
-    factory::addSphere(x,y,z,r, 3 + t);
+    gmsh::model::occ::addSphere(x,y,z,r, 3 + t);
     holes.push_back({3, 3 + t});
   }
 
@@ -62,7 +59,7 @@ int main(int argc, char **argv)
   // want five spherical inclusions, whose mesh should be conformal with the
   // mesh of the cube: we thus use `fragment()', which intersects all volumes in
   // a conformal manner (without creating duplicate interfaces):
-  factory::fragment({{3,3}}, holes, ov, ovv);
+  gmsh::model::occ::fragment({{3,3}}, holes, ov, ovv);
 
   // ov contains all the generated entities of the same dimension as the input
   // entities:
@@ -85,7 +82,7 @@ int main(int argc, char **argv)
     gmsh::logger::write(s);
   }
 
-  factory::synchronize();
+  gmsh::model::occ::synchronize();
 
   // When the boolean operation leads to simple modifications of entities, and
   // if one deletes the original entities, Gmsh tries to assign the same tag to
@@ -116,20 +113,20 @@ int main(int argc, char **argv)
   double lcar3 = .055;
 
   // Assign a mesh size to all the points:
-  model::getEntities(ov, 0);
-  model::mesh::setSize(ov, lcar1);
+  gmsh::model::getEntities(ov, 0);
+  gmsh::model::mesh::setSize(ov, lcar1);
 
   // Override this constraint on the points of the five spheres:
-  model::getBoundary(holes, ov, false, false, true);
-  model::mesh::setSize(ov, lcar3);
+  gmsh::model::getBoundary(holes, ov, false, false, true);
+  gmsh::model::mesh::setSize(ov, lcar3);
 
   // Select the corner point by searching for it geometrically:
   double eps = 1e-3;
-  model::getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
+  gmsh::model::getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
                                   0.5+eps, 0.5+eps, 0.5+eps, ov, 0);
-  model::mesh::setSize(ov, lcar2);
+  gmsh::model::mesh::setSize(ov, lcar2);
 
-  model::mesh::generate(3);
+  gmsh::model::mesh::generate(3);
 
   gmsh::write("t16.msh");
 
diff --git a/tutorial/c++/t17.cpp b/tutorial/c++/t17.cpp
index 7288b151fead35805dcce1073337893ba7c8686b..adfdd97cc598f4160f7549c3e231cebb2fdbf024 100644
--- a/tutorial/c++/t17.cpp
+++ b/tutorial/c++/t17.cpp
@@ -17,9 +17,6 @@
 #include <gmsh.h>
 #include <math.h>
 
-namespace factory = gmsh::model::geo;
-namespace model = gmsh::model;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize();
diff --git a/tutorial/c++/t2.cpp b/tutorial/c++/t2.cpp
index cd5d7c913c66f22a0ac0187a32e272c1c991e27e..e2a7e90c5c789332e2ac84b38080f85fdd9fe7dc 100644
--- a/tutorial/c++/t2.cpp
+++ b/tutorial/c++/t2.cpp
@@ -9,10 +9,6 @@
 #include <gmsh.h>
 #include <math.h>
 
-// We start by giving some nice shortcuts for some namespaces
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   // If argc/argv are passed to gmsh::initialize(), Gmsh will parse the command
@@ -21,28 +17,28 @@ int main(int argc, char **argv)
 
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t2");
+  gmsh::model::add("t2");
 
   // Copied from t1.cpp...
   double lc = 1e-2;
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(.1, 0,  0, lc, 2);
-  factory::addPoint(.1, .3, 0, lc, 3);
-  factory::addPoint(0,  .3, 0, lc, 4);
-  factory::addLine(1, 2, 1);
-  factory::addLine(3, 2, 2);
-  factory::addLine(3, 4, 3);
-  factory::addLine(4, 1, 4);
-  factory::addCurveLoop({4, 1, -2, 3}, 1);
-  factory::addPlaneSurface({1}, 1);
-  model::addPhysicalGroup(1, {1, 2, 4}, 5);
-  int ps = model::addPhysicalGroup(2, {1});
-  model::setPhysicalName(2, ps, "My surface");
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(.1, 0,  0, lc, 2);
+  gmsh::model::geo::addPoint(.1, .3, 0, lc, 3);
+  gmsh::model::geo::addPoint(0,  .3, 0, lc, 4);
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(3, 2, 2);
+  gmsh::model::geo::addLine(3, 4, 3);
+  gmsh::model::geo::addLine(4, 1, 4);
+  gmsh::model::geo::addCurveLoop({4, 1, -2, 3}, 1);
+  gmsh::model::geo::addPlaneSurface({1}, 1);
+  gmsh::model::addPhysicalGroup(1, {1, 2, 4}, 5);
+  int ps = gmsh::model::addPhysicalGroup(2, {1});
+  gmsh::model::setPhysicalName(2, ps, "My surface");
 
   // We can then add new points and curves in the same way as we did in
   // `t1.cpp':
-  factory::addPoint(0, .4, 0, lc, 5);
-  factory::addLine(4, 5, 5);
+  gmsh::model::geo::addPoint(0, .4, 0, lc, 5);
+  gmsh::model::geo::addLine(4, 5, 5);
 
   // But Gmsh also provides tools to transform (translate, rotate, etc.)
   // elementary entities or copies of elementary entities.  Geometrical
@@ -50,11 +46,11 @@ int main(int argc, char **argv)
   // contains the list of entities, represented by (dimension, tag) pairs.  For
   // example, the point 5 (dimension=0, tag=5) can be moved by 0.02 to the left
   // (dx=-0.02, dy=0, dz=0) with
-  factory::translate({{0, 5}}, -0.02, 0, 0);
+  gmsh::model::geo::translate({{0, 5}}, -0.02, 0, 0);
 
   // And it can be further rotated by -Pi/4 around (0, 0.3, 0) (with the
   // rotation along the z axis) with:
-  factory::rotate({{0, 5}}, 0,0.3,0, 0,0,1, -M_PI/4);
+  gmsh::model::geo::rotate({{0, 5}}, 0,0.3,0, 0,0,1, -M_PI/4);
 
   // Note that there are no units in Gmsh: coordinates are just numbers - it's
   // up to the user to associate a meaning to them.
@@ -63,20 +59,20 @@ int main(int argc, char **argv)
   // the `copy()' function, which takes a vector of (dim, tag) pairs as input,
   // and returns another vector of (dim, tag) pairs:
   std::vector<std::pair<int, int> > ov;
-  factory::copy({{0, 3}}, ov);
-  factory::translate(ov, 0, 0.05, 0);
+  gmsh::model::geo::copy({{0, 3}}, ov);
+  gmsh::model::geo::translate(ov, 0, 0.05, 0);
 
   // The new point tag is available in ov[0].second, and can be used to create
   // new lines:
-  factory::addLine(3, ov[0].second, 7);
-  factory::addLine(ov[0].second, 5, 8);
-  factory::addCurveLoop({5,-8,-7,3}, 10);
-  factory::addPlaneSurface({10}, 11);
+  gmsh::model::geo::addLine(3, ov[0].second, 7);
+  gmsh::model::geo::addLine(ov[0].second, 5, 8);
+  gmsh::model::geo::addCurveLoop({5,-8,-7,3}, 10);
+  gmsh::model::geo::addPlaneSurface({10}, 11);
 
   // In the same way, we can translate copies of the two surfaces 1 and 11 to
   // the right with the following command:
-  factory::copy({{2, 1}, {2, 11}}, ov);
-  factory::translate(ov, 0.12, 0, 0);
+  gmsh::model::geo::copy({{2, 1}, {2, 11}}, ov);
+  gmsh::model::geo::translate(ov, 0.12, 0, 0);
 
   std::printf("New surfaces '%d' and '%d'\n", ov[0].second, ov[1].second);
 
@@ -84,39 +80,39 @@ int main(int argc, char **argv)
   // one defines curve loops to build surfaces, one has to define surface loops
   // (i.e. `shells') to build volumes. The following volume does not have holes
   // and thus consists of a single surface loop:
-  factory::addPoint(0., 0.3, 0.12, lc, 100);
-  factory::addPoint(0.1, 0.3, 0.12, lc, 101);
-  factory::addPoint(0.1, 0.35, 0.12, lc, 102);
+  gmsh::model::geo::addPoint(0., 0.3, 0.12, lc, 100);
+  gmsh::model::geo::addPoint(0.1, 0.3, 0.12, lc, 101);
+  gmsh::model::geo::addPoint(0.1, 0.35, 0.12, lc, 102);
 
   // We would like to retrieve the coordinates of point 5 to create point 103,
   // so we synchronize the model, and use `getValue()'
-  factory::synchronize();
+  gmsh::model::geo::synchronize();
   std::vector<double> xyz;
-  model::getValue(0, 5, {}, xyz);
-  factory::addPoint(xyz[0], xyz[1], 0.12, lc, 103);
-
-  factory::addLine(4, 100, 110);
-  factory::addLine(3, 101, 111);
-  factory::addLine(6, 102, 112);
-  factory::addLine(5, 103, 113);
-  factory::addLine(103, 100, 114);
-  factory::addLine(100, 101, 115);
-  factory::addLine(101, 102, 116);
-  factory::addLine(102, 103, 117);
-
-  factory::addCurveLoop({115, -111, 3, 110}, 118);
-  factory::addPlaneSurface({118}, 119);
-  factory::addCurveLoop({111, 116, -112, -7}, 120);
-  factory::addPlaneSurface({120}, 121);
-  factory::addCurveLoop({112, 117, -113, -8}, 122);
-  factory::addPlaneSurface({122}, 123);
-  factory::addCurveLoop({114, -110, 5, 113}, 124);
-  factory::addPlaneSurface({124}, 125);
-  factory::addCurveLoop({115, 116, 117, 114}, 126);
-  factory::addPlaneSurface({126}, 127);
-
-  factory::addSurfaceLoop({127, 119, 121, 123, 125, 11}, 128);
-  factory::addVolume({128}, 129);
+  gmsh::model::getValue(0, 5, {}, xyz);
+  gmsh::model::geo::addPoint(xyz[0], xyz[1], 0.12, lc, 103);
+
+  gmsh::model::geo::addLine(4, 100, 110);
+  gmsh::model::geo::addLine(3, 101, 111);
+  gmsh::model::geo::addLine(6, 102, 112);
+  gmsh::model::geo::addLine(5, 103, 113);
+  gmsh::model::geo::addLine(103, 100, 114);
+  gmsh::model::geo::addLine(100, 101, 115);
+  gmsh::model::geo::addLine(101, 102, 116);
+  gmsh::model::geo::addLine(102, 103, 117);
+
+  gmsh::model::geo::addCurveLoop({115, -111, 3, 110}, 118);
+  gmsh::model::geo::addPlaneSurface({118}, 119);
+  gmsh::model::geo::addCurveLoop({111, 116, -112, -7}, 120);
+  gmsh::model::geo::addPlaneSurface({120}, 121);
+  gmsh::model::geo::addCurveLoop({112, 117, -113, -8}, 122);
+  gmsh::model::geo::addPlaneSurface({122}, 123);
+  gmsh::model::geo::addCurveLoop({114, -110, 5, 113}, 124);
+  gmsh::model::geo::addPlaneSurface({124}, 125);
+  gmsh::model::geo::addCurveLoop({115, 116, 117, 114}, 126);
+  gmsh::model::geo::addPlaneSurface({126}, 127);
+
+  gmsh::model::geo::addSurfaceLoop({127, 119, 121, 123, 125, 11}, 128);
+  gmsh::model::geo::addVolume({128}, 129);
 
   // When a volume can be extruded from a surface, it is usually easier to use
   // the `extrude()' function directly instead of creating all the points,
@@ -126,22 +122,22 @@ int main(int argc, char **argv)
   // function takes a vector of (dim, tag) pairs as input as well as the
   // translation vector, and returns a vector of (dim, tag) pairs as output:
   std::vector<std::pair<int, int> > ov2;
-  factory::extrude({ov[1]}, 0, 0, 0.12, ov2);
+  gmsh::model::geo::extrude({ov[1]}, 0, 0, 0.12, ov2);
 
   // Mesh sizes associated to geometrical points can be set by passing a vector
   // of (dim, tag) pairs for the corresponding points:
-  factory::mesh::setSize({{0,103}, {0,105}, {0,109}, {0,102}, {0,28},
-                          {0, 24}, {0,6}, {0,5}}, lc * 3);
+  gmsh::model::geo::mesh::setSize({{0,103}, {0,105}, {0,109}, {0,102}, {0,28},
+                                   {0, 24}, {0,6}, {0,5}}, lc * 3);
 
   // We finally group volumes 129 and 130 in a single physical group with tag
   // `1' and name "The volume":
-  model::addPhysicalGroup(3, {129, 130}, 1);
-  model::setPhysicalName(3, 1, "The volume");
+  gmsh::model::addPhysicalGroup(3, {129, 130}, 1);
+  gmsh::model::setPhysicalName(3, 1, "The volume");
 
   // We finish by synchronizing the data from the built-in geometry kernel with
   // the Gmsh model, and by generating and saving the mesh:
-  factory::synchronize();
-  model::mesh::generate(3);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::generate(3);
   gmsh::write("t2.msh");
 
   // Note that, if the transformation tools are handy to create complex
diff --git a/tutorial/c++/t3.cpp b/tutorial/c++/t3.cpp
index 12f6ae06396931b21021565d9d50562cf670d4fe..c5877bdaa6761a3ef106f8c19d13a77713c45b20 100644
--- a/tutorial/c++/t3.cpp
+++ b/tutorial/c++/t3.cpp
@@ -9,31 +9,28 @@
 #include <cmath>
 #include <gmsh.h>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize(argc, argv);
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t3");
+  gmsh::model::add("t3");
 
   // Copied from t1.cpp...
   double lc = 1e-2;
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(.1, 0,  0, lc, 2);
-  factory::addPoint(.1, .3, 0, lc, 3);
-  factory::addPoint(0,  .3, 0, lc, 4);
-  factory::addLine(1, 2, 1);
-  factory::addLine(3, 2, 2);
-  factory::addLine(3, 4, 3);
-  factory::addLine(4, 1, 4);
-  factory::addCurveLoop({4, 1, -2, 3}, 1);
-  factory::addPlaneSurface({1}, 1);
-  model::addPhysicalGroup(1, {1, 2, 4}, 5);
-  int ps = model::addPhysicalGroup(2, {1});
-  model::setPhysicalName(2, ps, "My surface");
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(.1, 0,  0, lc, 2);
+  gmsh::model::geo::addPoint(.1, .3, 0, lc, 3);
+  gmsh::model::geo::addPoint(0,  .3, 0, lc, 4);
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(3, 2, 2);
+  gmsh::model::geo::addLine(3, 4, 3);
+  gmsh::model::geo::addLine(4, 1, 4);
+  gmsh::model::geo::addCurveLoop({4, 1, -2, 3}, 1);
+  gmsh::model::geo::addPlaneSurface({1}, 1);
+  gmsh::model::addPhysicalGroup(1, {1, 2, 4}, 5);
+  int ps = gmsh::model::addPhysicalGroup(2, {1});
+  gmsh::model::setPhysicalName(2, ps, "My surface");
 
   // As in `t2.cpp', we plan to perform an extrusion along the z axis.  But
   // here, instead of only extruding the geometry, we also want to extrude the
@@ -45,14 +42,14 @@ int main(int argc, char **argv)
 
   double h = 0.1, angle = 90.;
   std::vector<std::pair<int, int> > ov;
-  factory::extrude({{2,1}}, 0, 0, h, ov, {8,2}, {0.5,1});
+  gmsh::model::geo::extrude({{2,1}}, 0, 0, h, ov, {8,2}, {0.5,1});
 
   // The extrusion can also be performed with a rotation instead of a
   // translation, and the resulting mesh can be recombined into prisms (we use
   // only one layer here, with 7 subdivisions). All rotations are specified by
   // an an axis point (-0.1, 0, 0.1), an axis direction (0, 1, 0), and a
   // rotation angle (-Pi/2):
-  factory::revolve({{2,28}}, -0.1,0,0.1, 0,1,0, -M_PI/2, ov, {7});
+  gmsh::model::geo::revolve({{2,28}}, -0.1,0,0.1, 0,1,0, -M_PI/2, ov, {7});
 
   // Using the built-in geometry kernel, only rotations with angles < Pi are
   // supported. To do a full turn, you will thus need to apply at least 3
@@ -62,10 +59,10 @@ int main(int argc, char **argv)
   // can also be combined to form a "twist".  The last (optional) argument for
   // the extrude() and twist() functions specifies whether the extruded mesh
   // should be recombined or not.
-  factory::twist({{2,50}}, 0,0.15,0.25, -2*h,0,0, 1,0,0, angle*M_PI/180.,
-                 ov, {10}, {}, true);
+  gmsh::model::geo::twist({{2,50}}, 0,0.15,0.25, -2*h,0,0, 1,0,0,
+                          angle*M_PI/180., ov, {10}, {}, true);
 
-  factory::synchronize();
+  gmsh::model::geo::synchronize();
 
   // All the extrusion functions return a vector of extruded entities: the "top"
   // of the extruded surface (in `ov[0]'), the newly created volume (in `ov[1]')
@@ -73,9 +70,9 @@ int main(int argc, char **argv)
 
   // We can then define a new physical volume (with tag 101) to group all the
   // elementary volumes:
-  model::addPhysicalGroup(3, {1, 2, ov[1].second}, 101);
+  gmsh::model::addPhysicalGroup(3, {1, 2, ov[1].second}, 101);
 
-  model::mesh::generate(3);
+  gmsh::model::mesh::generate(3);
   gmsh::write("t3.msh");
 
   // Let us now change some options... Since all interactive options are
diff --git a/tutorial/c++/t4.cpp b/tutorial/c++/t4.cpp
index 2bc86f762ab5c17e8bebb4b03e044f06ac4518a0..6e98192009c13577da71821c025e963704e7c560 100644
--- a/tutorial/c++/t4.cpp
+++ b/tutorial/c++/t4.cpp
@@ -9,9 +9,6 @@
 #include <math.h>
 #include <gmsh.h>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 double hypoth(double a, double b){ return sqrt(a * a + b * b); }
 
 int main(int argc, char **argv)
@@ -19,7 +16,7 @@ int main(int argc, char **argv)
   gmsh::initialize(argc, argv);
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t4");
+  gmsh::model::add("t4");
 
   double cm = 1e-02;
   double e1 = 4.5 * cm, e2 = 6 * cm / 2, e3 =  5 * cm / 2;
@@ -31,7 +28,9 @@ int main(int argc, char **argv)
   double ccos = (-h5*R1 + e2 * hypot(h5, hypot(e2, R1))) / (h5*h5 + e2*e2);
   double ssin = sqrt(1 - ccos*ccos);
 
-  // We start by defining some points and some lines:
+  // We start by defining some points and some lines. To make the code shorter
+  // we can redefine a namespace:
+  namespace factory = gmsh::model::geo;
   factory::addPoint(-e1-e2, 0    , 0, Lc1, 1);
   factory::addPoint(-e1-e2, h1   , 0, Lc1, 2);
   factory::addPoint(-e3-r , h1   , 0, Lc2, 3);
@@ -164,7 +163,7 @@ int main(int argc, char **argv)
   for(int i = 15; i <= 20; i++)
     gmsh::model::setColor({{1, i}}, 255, 255, 0); // Yellow
 
-  model::mesh::generate(2);
+  gmsh::model::mesh::generate(2);
 
   gmsh::write("t4.msh");
 
diff --git a/tutorial/c++/t5.cpp b/tutorial/c++/t5.cpp
index b0cdab88663e2ee29c5ff284c431486e3ef32692..30753b1137732568cd05155939a947a03c285f2d 100644
--- a/tutorial/c++/t5.cpp
+++ b/tutorial/c++/t5.cpp
@@ -9,44 +9,41 @@
 #include <gmsh.h>
 #include <cstdio>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 void cheeseHole(double x, double y, double z, double r, double lc,
                 std::vector<int> &shells, std::vector<int> &volumes)
 {
   // This function will create a spherical hole in a volume. We don't specify
   // tags manually, and let the functions return them automatically:
 
-  int p1 = factory::addPoint(x,  y,  z,  lc);
-  int p2 = factory::addPoint(x+r,y,  z,   lc);
-  int p3 = factory::addPoint(x,  y+r,z,   lc);
-  int p4 = factory::addPoint(x,  y,  z+r, lc);
-  int p5 = factory::addPoint(x-r,y,  z,   lc);
-  int p6 = factory::addPoint(x,  y-r,z,   lc);
-  int p7 = factory::addPoint(x,  y,  z-r, lc);
-
-  int c1 = factory::addCircleArc(p2,p1,p7);
-  int c2 = factory::addCircleArc(p7,p1,p5);
-  int c3 = factory::addCircleArc(p5,p1,p4);
-  int c4 = factory::addCircleArc(p4,p1,p2);
-  int c5 = factory::addCircleArc(p2,p1,p3);
-  int c6 = factory::addCircleArc(p3,p1,p5);
-  int c7 = factory::addCircleArc(p5,p1,p6);
-  int c8 = factory::addCircleArc(p6,p1,p2);
-  int c9 = factory::addCircleArc(p7,p1,p3);
-  int c10 = factory::addCircleArc(p3,p1,p4);
-  int c11 = factory::addCircleArc(p4,p1,p6);
-  int c12 = factory::addCircleArc(p6,p1,p7);
-
-  int l1 = factory::addCurveLoop({c5,c10,c4});
-  int l2 = factory::addCurveLoop({c9,-c5,c1});
-  int l3 = factory::addCurveLoop({c12,-c8,-c1});
-  int l4 = factory::addCurveLoop({c8,-c4,c11});
-  int l5 = factory::addCurveLoop({-c10,c6,c3});
-  int l6 = factory::addCurveLoop({-c11,-c3,c7});
-  int l7 = factory::addCurveLoop({-c2,-c7,-c12});
-  int l8 = factory::addCurveLoop({-c6,-c9,c2});
+  int p1 = gmsh::model::geo::addPoint(x,  y,  z,  lc);
+  int p2 = gmsh::model::geo::addPoint(x+r,y,  z,   lc);
+  int p3 = gmsh::model::geo::addPoint(x,  y+r,z,   lc);
+  int p4 = gmsh::model::geo::addPoint(x,  y,  z+r, lc);
+  int p5 = gmsh::model::geo::addPoint(x-r,y,  z,   lc);
+  int p6 = gmsh::model::geo::addPoint(x,  y-r,z,   lc);
+  int p7 = gmsh::model::geo::addPoint(x,  y,  z-r, lc);
+
+  int c1 = gmsh::model::geo::addCircleArc(p2,p1,p7);
+  int c2 = gmsh::model::geo::addCircleArc(p7,p1,p5);
+  int c3 = gmsh::model::geo::addCircleArc(p5,p1,p4);
+  int c4 = gmsh::model::geo::addCircleArc(p4,p1,p2);
+  int c5 = gmsh::model::geo::addCircleArc(p2,p1,p3);
+  int c6 = gmsh::model::geo::addCircleArc(p3,p1,p5);
+  int c7 = gmsh::model::geo::addCircleArc(p5,p1,p6);
+  int c8 = gmsh::model::geo::addCircleArc(p6,p1,p2);
+  int c9 = gmsh::model::geo::addCircleArc(p7,p1,p3);
+  int c10 = gmsh::model::geo::addCircleArc(p3,p1,p4);
+  int c11 = gmsh::model::geo::addCircleArc(p4,p1,p6);
+  int c12 = gmsh::model::geo::addCircleArc(p6,p1,p7);
+
+  int l1 = gmsh::model::geo::addCurveLoop({c5,c10,c4});
+  int l2 = gmsh::model::geo::addCurveLoop({c9,-c5,c1});
+  int l3 = gmsh::model::geo::addCurveLoop({c12,-c8,-c1});
+  int l4 = gmsh::model::geo::addCurveLoop({c8,-c4,c11});
+  int l5 = gmsh::model::geo::addCurveLoop({-c10,c6,c3});
+  int l6 = gmsh::model::geo::addCurveLoop({-c11,-c3,c7});
+  int l7 = gmsh::model::geo::addCurveLoop({-c2,-c7,-c12});
+  int l8 = gmsh::model::geo::addCurveLoop({-c6,-c9,c2});
 
   // We need non-plane surfaces to define the spherical holes. Here we use the
   // `gmsh::model::geo::addSurfaceFilling()' function, which can be used for
@@ -60,17 +57,17 @@ void cheeseHole(double x, double y, double z, double r, double lc,
   // `gmsh::model::geo::addThruSections()' allows to create ruled surfaces (see
   // `t19.cpp').
 
-  int s1 = factory::addSurfaceFilling({l1});
-  int s2 = factory::addSurfaceFilling({l2});
-  int s3 = factory::addSurfaceFilling({l3});
-  int s4 = factory::addSurfaceFilling({l4});
-  int s5 = factory::addSurfaceFilling({l5});
-  int s6 = factory::addSurfaceFilling({l6});
-  int s7 = factory::addSurfaceFilling({l7});
-  int s8 = factory::addSurfaceFilling({l8});
-
-  int sl = factory::addSurfaceLoop({s1, s2, s3, s4, s5, s6, s7, s8});
-  int v = factory::addVolume({sl});
+  int s1 = gmsh::model::geo::addSurfaceFilling({l1});
+  int s2 = gmsh::model::geo::addSurfaceFilling({l2});
+  int s3 = gmsh::model::geo::addSurfaceFilling({l3});
+  int s4 = gmsh::model::geo::addSurfaceFilling({l4});
+  int s5 = gmsh::model::geo::addSurfaceFilling({l5});
+  int s6 = gmsh::model::geo::addSurfaceFilling({l6});
+  int s7 = gmsh::model::geo::addSurfaceFilling({l7});
+  int s8 = gmsh::model::geo::addSurfaceFilling({l8});
+
+  int sl = gmsh::model::geo::addSurfaceLoop({s1, s2, s3, s4, s5, s6, s7, s8});
+  int v = gmsh::model::geo::addVolume({sl});
   shells.push_back(sl);
   volumes.push_back(v);
 }
@@ -109,65 +106,65 @@ int main(int argc, char **argv)
 
   // We proceed by defining some elementary entities describing a truncated cube:
 
-  factory::addPoint(0.5,0.5,0.5, lcar2, 1);
-  factory::addPoint(0.5,0.5,0, lcar1, 2);
-  factory::addPoint(0,0.5,0.5, lcar1, 3);
-  factory::addPoint(0,0,0.5, lcar1, 4);
-  factory::addPoint(0.5,0,0.5, lcar1, 5);
-  factory::addPoint(0.5,0,0, lcar1, 6);
-  factory::addPoint(0,0.5,0, lcar1, 7);
-  factory::addPoint(0,1,0, lcar1, 8);
-  factory::addPoint(1,1,0, lcar1, 9);
-  factory::addPoint(0,0,1, lcar1, 10);
-  factory::addPoint(0,1,1, lcar1, 11);
-  factory::addPoint(1,1,1, lcar1, 12);
-  factory::addPoint(1,0,1, lcar1, 13);
-  factory::addPoint(1,0,0, lcar1, 14);
-
-  factory::addLine(8,9, 1);
-  factory::addLine(9,12, 2);
-  factory::addLine(12,11, 3);
-  factory::addLine(11,8, 4);
-  factory::addLine(9,14, 5);
-  factory::addLine(14,13, 6);
-  factory::addLine(13,12, 7);
-  factory::addLine(11,10, 8);
-  factory::addLine(10,13, 9);
-  factory::addLine(10,4, 10);
-  factory::addLine(4,5, 11);
-  factory::addLine(5,6, 12);
-  factory::addLine(6,2, 13);
-  factory::addLine(2,1, 14);
-  factory::addLine(1,3, 15);
-  factory::addLine(3,7, 16);
-  factory::addLine(7,2, 17);
-  factory::addLine(3,4, 18);
-  factory::addLine(5,1, 19);
-  factory::addLine(7,8, 20);
-  factory::addLine(6,14, 21);
-
-  factory::addCurveLoop({-11,-19,-15,-18}, 22);
-  factory::addPlaneSurface({22}, 23);
-  factory::addCurveLoop({16,17,14,15}, 24);
-  factory::addPlaneSurface({24}, 25);
-  factory::addCurveLoop({-17,20,1,5,-21,13}, 26);
-  factory::addPlaneSurface({26}, 27);
-  factory::addCurveLoop({-4,-1,-2,-3}, 28);
-  factory::addPlaneSurface({28}, 29);
-  factory::addCurveLoop({-7,2,-5,-6}, 30);
-  factory::addPlaneSurface({30}, 31);
-  factory::addCurveLoop({6,-9,10,11,12,21}, 32);
-  factory::addPlaneSurface({32}, 33);
-  factory::addCurveLoop({7,3,8,9}, 34);
-  factory::addPlaneSurface({34}, 35);
-  factory::addCurveLoop({-10,18,-16,-20,4,-8}, 36);
-  factory::addPlaneSurface({36}, 37);
-  factory::addCurveLoop({-14,-13,-12,19}, 38);
-  factory::addPlaneSurface({38}, 39);
+  gmsh::model::geo::addPoint(0.5,0.5,0.5, lcar2, 1);
+  gmsh::model::geo::addPoint(0.5,0.5,0, lcar1, 2);
+  gmsh::model::geo::addPoint(0,0.5,0.5, lcar1, 3);
+  gmsh::model::geo::addPoint(0,0,0.5, lcar1, 4);
+  gmsh::model::geo::addPoint(0.5,0,0.5, lcar1, 5);
+  gmsh::model::geo::addPoint(0.5,0,0, lcar1, 6);
+  gmsh::model::geo::addPoint(0,0.5,0, lcar1, 7);
+  gmsh::model::geo::addPoint(0,1,0, lcar1, 8);
+  gmsh::model::geo::addPoint(1,1,0, lcar1, 9);
+  gmsh::model::geo::addPoint(0,0,1, lcar1, 10);
+  gmsh::model::geo::addPoint(0,1,1, lcar1, 11);
+  gmsh::model::geo::addPoint(1,1,1, lcar1, 12);
+  gmsh::model::geo::addPoint(1,0,1, lcar1, 13);
+  gmsh::model::geo::addPoint(1,0,0, lcar1, 14);
+
+  gmsh::model::geo::addLine(8,9, 1);
+  gmsh::model::geo::addLine(9,12, 2);
+  gmsh::model::geo::addLine(12,11, 3);
+  gmsh::model::geo::addLine(11,8, 4);
+  gmsh::model::geo::addLine(9,14, 5);
+  gmsh::model::geo::addLine(14,13, 6);
+  gmsh::model::geo::addLine(13,12, 7);
+  gmsh::model::geo::addLine(11,10, 8);
+  gmsh::model::geo::addLine(10,13, 9);
+  gmsh::model::geo::addLine(10,4, 10);
+  gmsh::model::geo::addLine(4,5, 11);
+  gmsh::model::geo::addLine(5,6, 12);
+  gmsh::model::geo::addLine(6,2, 13);
+  gmsh::model::geo::addLine(2,1, 14);
+  gmsh::model::geo::addLine(1,3, 15);
+  gmsh::model::geo::addLine(3,7, 16);
+  gmsh::model::geo::addLine(7,2, 17);
+  gmsh::model::geo::addLine(3,4, 18);
+  gmsh::model::geo::addLine(5,1, 19);
+  gmsh::model::geo::addLine(7,8, 20);
+  gmsh::model::geo::addLine(6,14, 21);
+
+  gmsh::model::geo::addCurveLoop({-11,-19,-15,-18}, 22);
+  gmsh::model::geo::addPlaneSurface({22}, 23);
+  gmsh::model::geo::addCurveLoop({16,17,14,15}, 24);
+  gmsh::model::geo::addPlaneSurface({24}, 25);
+  gmsh::model::geo::addCurveLoop({-17,20,1,5,-21,13}, 26);
+  gmsh::model::geo::addPlaneSurface({26}, 27);
+  gmsh::model::geo::addCurveLoop({-4,-1,-2,-3}, 28);
+  gmsh::model::geo::addPlaneSurface({28}, 29);
+  gmsh::model::geo::addCurveLoop({-7,2,-5,-6}, 30);
+  gmsh::model::geo::addPlaneSurface({30}, 31);
+  gmsh::model::geo::addCurveLoop({6,-9,10,11,12,21}, 32);
+  gmsh::model::geo::addPlaneSurface({32}, 33);
+  gmsh::model::geo::addCurveLoop({7,3,8,9}, 34);
+  gmsh::model::geo::addPlaneSurface({34}, 35);
+  gmsh::model::geo::addCurveLoop({-10,18,-16,-20,4,-8}, 36);
+  gmsh::model::geo::addPlaneSurface({36}, 37);
+  gmsh::model::geo::addCurveLoop({-14,-13,-12,19}, 38);
+  gmsh::model::geo::addPlaneSurface({38}, 39);
 
   std::vector<int> shells, volumes;
 
-  int sl = factory::addSurfaceLoop({35,31,29,37,33,23,39,25,27});
+  int sl = gmsh::model::geo::addSurfaceLoop({35,31,29,37,33,23,39,25,27});
   shells.push_back(sl);
 
   // We create five holes in the cube:
@@ -176,7 +173,7 @@ int main(int argc, char **argv)
     x += 0.166 ;
     z += 0.166 ;
     cheeseHole(x, y, z, r, lcar3, shells, volumes);
-    model::addPhysicalGroup(3, {volumes.back()}, t);
+    gmsh::model::addPhysicalGroup(3, {volumes.back()}, t);
     std::printf("Hole %d (center = {%g,%g,%g}, radius = %g) has number %d!\n",
                 t, x, y, z, r, volumes.back());
   }
@@ -184,7 +181,7 @@ int main(int argc, char **argv)
   // The volume of the cube, without the 5 holes, is defined by 6 surface loops:
   // the first surface loop defines the exterior surface; the surface loops
   // other than the first one define holes:
-  int ve = factory::addVolume(shells);
+  int ve = gmsh::model::geo::addVolume(shells);
 
   // Note that using solid modelling with the OpenCASCADE geometry kernel, the
   // same geometry could be built quite differently: see `t16.cpp'.
@@ -192,9 +189,9 @@ int main(int argc, char **argv)
   // We finally define a physical volume for the elements discretizing the cube,
   // without the holes (for which physical groups were already defined in the
   // `cheeseHole()' function):
-  model::addPhysicalGroup(3, {ve}, 10);
+  gmsh::model::addPhysicalGroup(3, {ve}, 10);
 
-  factory::synchronize();
+  gmsh::model::geo::synchronize();
 
   // We could make only part of the model visible to only mesh this subset:
   // std::vector<std::pair<int, int> > ent;
@@ -222,7 +219,7 @@ int main(int argc, char **argv)
   // gmsh::option::setNumber("Mesh.ElementOrder", 2);
   // gmsh::option::setNumber("Mesh.HighOrderOptimize", 2);
 
-  model::mesh::generate(3);
+  gmsh::model::mesh::generate(3);
   gmsh::write("t5.msh");
 
   // gmsh::fltk::run();
diff --git a/tutorial/c++/t6.cpp b/tutorial/c++/t6.cpp
index bca2582659c354f0023cec678dfe36aba1817660..723eecdd54aced12a1157ec493efe32572cfb9fb 100644
--- a/tutorial/c++/t6.cpp
+++ b/tutorial/c++/t6.cpp
@@ -8,99 +8,96 @@
 
 #include <gmsh.h>
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize();
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t2");
+  gmsh::model::add("t2");
 
   // Copied from t1.cpp...
   double lc = 1e-2;
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(.1, 0,  0, lc, 2);
-  factory::addPoint(.1, .3, 0, lc, 3);
-  factory::addPoint(0,  .3, 0, lc, 4);
-  factory::addLine(1, 2, 1);
-  factory::addLine(3, 2, 2);
-  factory::addLine(3, 4, 3);
-  factory::addLine(4, 1, 4);
-  factory::addCurveLoop({4, 1, -2, 3}, 1);
-  factory::addPlaneSurface({1}, 1);
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(.1, 0,  0, lc, 2);
+  gmsh::model::geo::addPoint(.1, .3, 0, lc, 3);
+  gmsh::model::geo::addPoint(0,  .3, 0, lc, 4);
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(3, 2, 2);
+  gmsh::model::geo::addLine(3, 4, 3);
+  gmsh::model::geo::addLine(4, 1, 4);
+  gmsh::model::geo::addCurveLoop({4, 1, -2, 3}, 1);
+  gmsh::model::geo::addPlaneSurface({1}, 1);
 
   // Delete the surface and the left line, and replace the line with 3 new ones:
-  factory::remove({{2,1}, {1,4}});
+  gmsh::model::geo::remove({{2,1}, {1,4}});
 
-  int p1 = factory::addPoint(-0.05, 0.05, 0, lc);
-  int p2 = factory::addPoint(-0.05, 0.1, 0, lc);
-  int l1 = factory::addLine(1, p1);
-  int l2 = factory::addLine(p1, p2);
-  int l3 = factory::addLine(p2, 4);
+  int p1 = gmsh::model::geo::addPoint(-0.05, 0.05, 0, lc);
+  int p2 = gmsh::model::geo::addPoint(-0.05, 0.1, 0, lc);
+  int l1 = gmsh::model::geo::addLine(1, p1);
+  int l2 = gmsh::model::geo::addLine(p1, p2);
+  int l3 = gmsh::model::geo::addLine(p2, 4);
 
   // Create surface:
-  factory::addCurveLoop({2, -1, l1, l2, l3, -3}, 2);
-  factory::addPlaneSurface({-2}, 1);
+  gmsh::model::geo::addCurveLoop({2, -1, l1, l2, l3, -3}, 2);
+  gmsh::model::geo::addPlaneSurface({-2}, 1);
 
   // The `setTransfiniteCurve()' meshing constraints explicitly specifies the
   // location of the nodes on the curve. For example, the following command
   // forces 20 uniformly placed nodes on curve 2 (including the nodes on the two
   // end points):
-  factory::mesh::setTransfiniteCurve(2, 20);
+  gmsh::model::geo::mesh::setTransfiniteCurve(2, 20);
 
   // Let's put 20 points total on combination of curves `l1', `l2' and `l3'
   // (beware that the points `p1' and `p2' are shared by the curves, so we do
   // not create 6 + 6 + 10 = 22 nodes, but 20!)
-  factory::mesh::setTransfiniteCurve(l1, 6);
-  factory::mesh::setTransfiniteCurve(l2, 6);
-  factory::mesh::setTransfiniteCurve(l3, 10);
+  gmsh::model::geo::mesh::setTransfiniteCurve(l1, 6);
+  gmsh::model::geo::mesh::setTransfiniteCurve(l2, 6);
+  gmsh::model::geo::mesh::setTransfiniteCurve(l3, 10);
 
   // Finally, we put 30 nodes following a geometric progression on curve 1
   // (reversed) and on curve 3: Put 30 points following a geometric progression
-  factory::mesh::setTransfiniteCurve(1, 30, "Progression", -1.2);
-  factory::mesh::setTransfiniteCurve(3, 30, "Progression", 1.2);
+  gmsh::model::geo::mesh::setTransfiniteCurve(1, 30, "Progression", -1.2);
+  gmsh::model::geo::mesh::setTransfiniteCurve(3, 30, "Progression", 1.2);
 
   // The `setTransfiniteSurface()' meshing constraint uses a transfinite
   // interpolation algorithm in the parametric plane of the surface to connect
   // the nodes on the boundary using a structured grid. If the surface has more
   // than 4 corner points, the corners of the transfinite interpolation have to
   // be specified by hand:
-  factory::mesh::setTransfiniteSurface(1, "Left", {1,2,3,4});
+  gmsh::model::geo::mesh::setTransfiniteSurface(1, "Left", {1,2,3,4});
 
   // To create quadrangles instead of triangles, one can use the `setRecombine'
   // constraint:
-  factory::mesh::setRecombine(2, 1);
+  gmsh::model::geo::mesh::setRecombine(2, 1);
 
   // When the surface has only 3 or 4 points on its boundary the list of corners
   // can be omitted in the `setTransfiniteSurface()' call:
-  factory::addPoint(0.2, 0.2, 0, 1.0, 7);
-  factory::addPoint(0.2, 0.1, 0, 1.0, 8);
-  factory::addPoint(0, 0.3, 0, 1.0, 9);
-  factory::addPoint(0.25, 0.2, 0, 1.0, 10);
-  factory::addPoint(0.3, 0.1, 0, 1.0, 11);
-  factory::addLine(8, 11, 10);
-  factory::addLine(11, 10, 11);
-  factory::addLine(10, 7, 12);
-  factory::addLine(7, 8, 13);
-  factory::addCurveLoop({13, 10, 11, 12}, 14);
-  factory::addPlaneSurface({14}, 15);
+  gmsh::model::geo::addPoint(0.2, 0.2, 0, 1.0, 7);
+  gmsh::model::geo::addPoint(0.2, 0.1, 0, 1.0, 8);
+  gmsh::model::geo::addPoint(0, 0.3, 0, 1.0, 9);
+  gmsh::model::geo::addPoint(0.25, 0.2, 0, 1.0, 10);
+  gmsh::model::geo::addPoint(0.3, 0.1, 0, 1.0, 11);
+  gmsh::model::geo::addLine(8, 11, 10);
+  gmsh::model::geo::addLine(11, 10, 11);
+  gmsh::model::geo::addLine(10, 7, 12);
+  gmsh::model::geo::addLine(7, 8, 13);
+  gmsh::model::geo::addCurveLoop({13, 10, 11, 12}, 14);
+  gmsh::model::geo::addPlaneSurface({14}, 15);
   for(int i = 10; i <= 13; i++)
-    factory::mesh::setTransfiniteCurve(i, 10);
-  factory::mesh::setTransfiniteSurface(15);
+    gmsh::model::geo::mesh::setTransfiniteCurve(i, 10);
+  gmsh::model::geo::mesh::setTransfiniteSurface(15);
 
   // The way triangles are generated can be controlled by specifying "Left",
   // "Right" or "Alternate" in `setTransfiniteSurface()' command. Try e.g.
   //
-  // factory::mesh::setTransfiniteSurface(15, "Alternate");
+  // gmsh::model::geo::mesh::setTransfiniteSurface(15, "Alternate");
 
   // Finally we apply an elliptic smoother to the grid to have a more regular
   // mesh:
   gmsh::option::setNumber("Mesh.Smoothing", 100);
 
-  factory::synchronize();
-  model::mesh::generate(2);
+  gmsh::model::geo::synchronize();
+  gmsh::model::mesh::generate(2);
   gmsh::write("t6.msh");
   gmsh::finalize();
   return 0;
diff --git a/tutorial/c++/t8.cpp b/tutorial/c++/t8.cpp
index dc0341a4dabbaa220b5bfc15db063410c96c1fe1..204c4df72165e2413ff3a835baca83ca9799e164 100644
--- a/tutorial/c++/t8.cpp
+++ b/tutorial/c++/t8.cpp
@@ -11,30 +11,26 @@
 // In addition to creating geometries and meshes, the C++ API can also be used
 // to manipulate post-processing datasets (called "views" in Gmsh).
 
-namespace model = gmsh::model;
-namespace factory = gmsh::model::geo;
-namespace option = gmsh::option;
-
 int main(int argc, char **argv)
 {
   gmsh::initialize();
   gmsh::option::setNumber("General.Terminal", 1);
 
-  model::add("t8");
+  gmsh::model::add("t8");
 
   // We first create a simple geometry
   double lc = 1e-2;
-  factory::addPoint(0, 0, 0, lc, 1);
-  factory::addPoint(.1, 0,  0, lc, 2);
-  factory::addPoint(.1, .3, 0, lc, 3);
-  factory::addPoint(0,  .3, 0, lc, 4);
-  factory::addLine(1, 2, 1);
-  factory::addLine(3, 2, 2);
-  factory::addLine(3, 4, 3);
-  factory::addLine(4, 1, 4);
-  factory::addCurveLoop({4, 1, -2, 3}, 1);
-  factory::addPlaneSurface({1}, 1);
-  factory::synchronize();
+  gmsh::model::geo::addPoint(0, 0, 0, lc, 1);
+  gmsh::model::geo::addPoint(.1, 0,  0, lc, 2);
+  gmsh::model::geo::addPoint(.1, .3, 0, lc, 3);
+  gmsh::model::geo::addPoint(0,  .3, 0, lc, 4);
+  gmsh::model::geo::addLine(1, 2, 1);
+  gmsh::model::geo::addLine(3, 2, 2);
+  gmsh::model::geo::addLine(3, 4, 3);
+  gmsh::model::geo::addLine(4, 1, 4);
+  gmsh::model::geo::addCurveLoop({4, 1, -2, 3}, 1);
+  gmsh::model::geo::addPlaneSurface({1}, 1);
+  gmsh::model::geo::synchronize();
 
   // We merge some post-processing views to work on
   try {
@@ -56,54 +52,54 @@ int main(int argc, char **argv)
   // directly from the C++ API.
 
   // We then set some general options:
-  option::setNumber("General.Trackball", 0);
-  option::setNumber("General.RotationX", 0);
-  option::setNumber("General.RotationY", 0);
-  option::setNumber("General.RotationZ", 0);
+  gmsh::option::setNumber("General.Trackball", 0);
+  gmsh::option::setNumber("General.RotationX", 0);
+  gmsh::option::setNumber("General.RotationY", 0);
+  gmsh::option::setNumber("General.RotationZ", 0);
 
   int white[3] = {255, 255, 255};
   int black[3] = {0, 0, 0};
-  option::setColor("General.Background", white[0], white[1], white[2]);
+  gmsh::option::setColor("General.Background", white[0], white[1], white[2]);
 
   // We can make our own shorter versions of repetitive methods
   auto set_color = [] (std::string name, int c[3]) -> void
-                   { option::setColor(name, c[0], c[1], c[2]); };
+                   { gmsh::option::setColor(name, c[0], c[1], c[2]); };
   set_color("General.Foreground", black);
   set_color("General.Text", black);
 
-  option::setNumber("General.Orthographic", 0);
-  option::setNumber("General.Axes", 0);
-  option::setNumber("General.SmallAxes", 0);
+  gmsh::option::setNumber("General.Orthographic", 0);
+  gmsh::option::setNumber("General.Axes", 0);
+  gmsh::option::setNumber("General.SmallAxes", 0);
 
   // Show the GUI
   gmsh::fltk::initialize();
 
   // We also set some options for each post-processing view:
-  option::setNumber("View[0].IntervalsType", 2);
-  option::setNumber("View[0].OffsetZ", 0.05);
-  option::setNumber("View[0].RaiseZ", 0);
-  option::setNumber("View[0].Light", 1);
-  option::setNumber("View[0].ShowScale", 0);
-  option::setNumber("View[0].SmoothNormals", 1);
-
-  option::setNumber("View[1].IntervalsType", 1);
+  gmsh::option::setNumber("View[0].IntervalsType", 2);
+  gmsh::option::setNumber("View[0].OffsetZ", 0.05);
+  gmsh::option::setNumber("View[0].RaiseZ", 0);
+  gmsh::option::setNumber("View[0].Light", 1);
+  gmsh::option::setNumber("View[0].ShowScale", 0);
+  gmsh::option::setNumber("View[0].SmoothNormals", 1);
+
+  gmsh::option::setNumber("View[1].IntervalsType", 1);
   // We can't yet set the ColorTable through the API
-  // option::setColorTable("View[1].ColorTable", "{ Green, Blue }");
-  option::setNumber("View[1].NbIso", 10);
-  option::setNumber("View[1].ShowScale", 0);
-
-  option::setString("View[2].Name", "Test...");
-  option::setNumber("View[2].Axes", 1);
-  option::setNumber("View[2].IntervalsType", 2);
-  option::setNumber("View[2].Type", 2);
-  option::setNumber("View[2].IntervalsType", 2);
-  option::setNumber("View[2].AutoPosition", 0);
-  option::setNumber("View[2].PositionX", 85);
-  option::setNumber("View[2].PositionY", 50);
-  option::setNumber("View[2].Width", 200);
-  option::setNumber("View[2].Height", 130);
-
-  option::setNumber("View[3].Visible", 0);
+  // gmsh::option::setColorTable("View[1].ColorTable", "{ Green, Blue }");
+  gmsh::option::setNumber("View[1].NbIso", 10);
+  gmsh::option::setNumber("View[1].ShowScale", 0);
+
+  gmsh::option::setString("View[2].Name", "Test...");
+  gmsh::option::setNumber("View[2].Axes", 1);
+  gmsh::option::setNumber("View[2].IntervalsType", 2);
+  gmsh::option::setNumber("View[2].Type", 2);
+  gmsh::option::setNumber("View[2].IntervalsType", 2);
+  gmsh::option::setNumber("View[2].AutoPosition", 0);
+  gmsh::option::setNumber("View[2].PositionX", 85);
+  gmsh::option::setNumber("View[2].PositionY", 50);
+  gmsh::option::setNumber("View[2].Width", 200);
+  gmsh::option::setNumber("View[2].Height", 130);
+
+  gmsh::option::setNumber("View[3].Visible", 0);
 
   // You can save an MPEG movie directly by selecting `File->Export' in the
   // GUI. Several predefined animations are setup, for looping on all the time
@@ -119,24 +115,24 @@ int main(int argc, char **argv)
   for(int num = 1; num <= 3; num++) {
 
     double nbt;
-    option::getNumber("View[0].NbTimeStep", nbt);
+    gmsh::option::getNumber("View[0].NbTimeStep", nbt);
     t = (t < nbt - 1) ? t + 1 : 0;
 
     // Set time step
-    option::setNumber("View[0].TimeStep", t);
-    option::setNumber("View[1].TimeStep", t);
-    option::setNumber("View[2].TimeStep", t);
-    option::setNumber("View[3].TimeStep", t);
+    gmsh::option::setNumber("View[0].TimeStep", t);
+    gmsh::option::setNumber("View[1].TimeStep", t);
+    gmsh::option::setNumber("View[2].TimeStep", t);
+    gmsh::option::setNumber("View[3].TimeStep", t);
 
     double max;
-    option::getNumber("View[0].Max", max);
-    option::setNumber("View[0].RaiseZ", 0.01 / max * t);
+    gmsh::option::getNumber("View[0].Max", max);
+    gmsh::option::setNumber("View[0].RaiseZ", 0.01 / max * t);
 
     if(num == 3) {
       double mw;
-      option::getNumber("General.MenuWidth", mw);
-      option::setNumber("General.GraphicsWidth", mw + 640);
-      option::setNumber("General.GraphicsHeight", 480);
+      gmsh::option::getNumber("General.MenuWidth", mw);
+      gmsh::option::setNumber("General.GraphicsWidth", mw + 640);
+      gmsh::option::setNumber("General.GraphicsHeight", 480);
     }
 
     int frames = 50;
@@ -144,12 +140,12 @@ int main(int argc, char **argv)
 
       // Incrementally rotate the scene
       double rotx;
-      option::getNumber("General.RotationX", rotx);
-      option::setNumber("General.RotationX", rotx + 10);
-      option::setNumber("General.RotationY", (rotx + 10) / 3.);
+      gmsh::option::getNumber("General.RotationX", rotx);
+      gmsh::option::setNumber("General.RotationX", rotx + 10);
+      gmsh::option::setNumber("General.RotationY", (rotx + 10) / 3.);
       double rotz;
-      option::getNumber("General.RotationZ", rotz);
-      option::setNumber("General.RotationZ", rotz + 0.1);
+      gmsh::option::getNumber("General.RotationZ", rotz);
+      gmsh::option::setNumber("General.RotationZ", rotz + 0.1);
 
       // Draw the scene
       gmsh::graphics::draw();
diff --git a/tutorial/julia/t16.jl b/tutorial/julia/t16.jl
index 6e72adde9198b8d70ad0b24200fffce5a0c21050..3ebf800ee19118a670a9ef741a195154441dc087 100644
--- a/tutorial/julia/t16.jl
+++ b/tutorial/julia/t16.jl
@@ -2,17 +2,14 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.occ
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t16")
+gmsh.model.add("t16")
 
-factory.addBox(0,0,0, 1,1,1, 1)
-factory.addBox(0,0,0, 0.5,0.5,0.5, 2)
-factory.cut([(3,1)], [(3,2)], 3)
+gmsh.model.occ.addBox(0,0,0, 1,1,1, 1)
+gmsh.model.occ.addBox(0,0,0, 0.5,0.5,0.5, 2)
+gmsh.model.occ.cut([(3,1)], [(3,2)], 3)
 
 x = 0; y = 0.75; z = 0; r = 0.09
 
@@ -21,30 +18,30 @@ for t in 1:5
     global x, z
     x += 0.166
     z += 0.166
-    factory.addSphere(x,y,z,r, 3 + t)
+    gmsh.model.occ.addSphere(x,y,z,r, 3 + t)
     t = (3, 3 + t)
     push!(holes, t)
 end
 
-ov = factory.fragment([(3,3)], holes)
-factory.synchronize()
+ov = gmsh.model.occ.fragment([(3,3)], holes)
+gmsh.model.occ.synchronize()
 
 lcar1 = .1
 lcar2 = .0005
 lcar3 = .055
 
-ov = model.getEntities(0);
-model.mesh.setSize(ov, lcar1);
+ov = gmsh.model.getEntities(0);
+gmsh.model.mesh.setSize(ov, lcar1);
 
-ov = model.getBoundary(holes, false, false, true);
-model.mesh.setSize(ov, lcar3);
+ov = gmsh.model.getBoundary(holes, false, false, true);
+gmsh.model.mesh.setSize(ov, lcar3);
 
 eps = 1e-3
-ov = model.getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
-                                    0.5+eps, 0.5+eps, 0.5+eps, 0)
-model.mesh.setSize(ov, lcar2)
+ov = gmsh.model.getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
+                                         0.5+eps, 0.5+eps, 0.5+eps, 0)
+gmsh.model.mesh.setSize(ov, lcar2)
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 
 gmsh.write("t16.msh")
 
diff --git a/tutorial/julia/t2.jl b/tutorial/julia/t2.jl
index bdd7ccc66155afbde581858d8fa9a024f2c01645..06dc8459531b7cc452eb0509499d93d404ac1edd 100644
--- a/tutorial/julia/t2.jl
+++ b/tutorial/julia/t2.jl
@@ -2,92 +2,89 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize(ARGS)
 
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t2")
+gmsh.model.add("t2")
 
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-model.addPhysicalGroup(0, [1, 2], 1)
-model.addPhysicalGroup(1, [1, 2], 2)
-model.addPhysicalGroup(2, [1], 6)
-model.setPhysicalName(2, 6, "My surface")
-
-factory.addPoint(0, .4, 0, lc, 5)
-factory.addLine(4, 5, 5)
-
-factory.translate([(0, 5)], -0.02, 0, 0)
-factory.rotate([(0, 5)], 0,0.3,0, 0,0,1, -pi/4)
-
-ov = factory.copy([(0, 3)])
-factory.translate(ov, 0, 0.05, 0)
-
-factory.addLine(3, ov[1][2], 7)
-factory.addLine(ov[1][2], 5, 8)
-factory.addCurveLoop([5,-8,-7,3], 10)
-factory.addPlaneSurface([10], 11)
-
-ov = factory.copy([(2, 1), (2, 11)])
-factory.translate(ov, 0.12, 0, 0)
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+gmsh.model.addPhysicalGroup(0, [1, 2], 1)
+gmsh.model.addPhysicalGroup(1, [1, 2], 2)
+gmsh.model.addPhysicalGroup(2, [1], 6)
+gmsh.model.setPhysicalName(2, 6, "My surface")
+
+gmsh.model.geo.addPoint(0, .4, 0, lc, 5)
+gmsh.model.geo.addLine(4, 5, 5)
+
+gmsh.model.geo.translate([(0, 5)], -0.02, 0, 0)
+gmsh.model.geo.rotate([(0, 5)], 0,0.3,0, 0,0,1, -pi/4)
+
+ov = gmsh.model.geo.copy([(0, 3)])
+gmsh.model.geo.translate(ov, 0, 0.05, 0)
+
+gmsh.model.geo.addLine(3, ov[1][2], 7)
+gmsh.model.geo.addLine(ov[1][2], 5, 8)
+gmsh.model.geo.addCurveLoop([5,-8,-7,3], 10)
+gmsh.model.geo.addPlaneSurface([10], 11)
+
+ov = gmsh.model.geo.copy([(2, 1), (2, 11)])
+gmsh.model.geo.translate(ov, 0.12, 0, 0)
 
 println("New surfaces ", ov[1][2], " and ", ov[2][2])
 
-factory.addPoint(0., 0.3, 0.12, lc, 100)
-factory.addPoint(0.1, 0.3, 0.12, lc, 101)
-factory.addPoint(0.1, 0.35, 0.12, lc, 102)
+gmsh.model.geo.addPoint(0., 0.3, 0.12, lc, 100)
+gmsh.model.geo.addPoint(0.1, 0.3, 0.12, lc, 101)
+gmsh.model.geo.addPoint(0.1, 0.35, 0.12, lc, 102)
 
-factory.synchronize()
-xyz = model.getValue(0, 5, [])
-factory.addPoint(xyz[1], xyz[2], 0.12, lc, 103)
+gmsh.model.geo.synchronize()
+xyz = gmsh.model.getValue(0, 5, [])
+gmsh.model.geo.addPoint(xyz[1], xyz[2], 0.12, lc, 103)
 
-factory.addLine(4, 100, 110)
-factory.addLine(3, 101, 111)
-factory.addLine(6, 102, 112)
-factory.addLine(5, 103, 113)
-factory.addLine(103, 100, 114)
-factory.addLine(100, 101, 115)
-factory.addLine(101, 102, 116)
-factory.addLine(102, 103, 117)
+gmsh.model.geo.addLine(4, 100, 110)
+gmsh.model.geo.addLine(3, 101, 111)
+gmsh.model.geo.addLine(6, 102, 112)
+gmsh.model.geo.addLine(5, 103, 113)
+gmsh.model.geo.addLine(103, 100, 114)
+gmsh.model.geo.addLine(100, 101, 115)
+gmsh.model.geo.addLine(101, 102, 116)
+gmsh.model.geo.addLine(102, 103, 117)
 
-factory.addCurveLoop([115, -111, 3, 110], 118)
-factory.addPlaneSurface([118], 119)
-factory.addCurveLoop([111, 116, -112, -7], 120)
-factory.addPlaneSurface([120], 121)
-factory.addCurveLoop([112, 117, -113, -8], 122)
-factory.addPlaneSurface([122], 123)
-factory.addCurveLoop([114, -110, 5, 113], 124)
-factory.addPlaneSurface([124], 125)
-factory.addCurveLoop([115, 116, 117, 114], 126)
-factory.addPlaneSurface([126], 127)
+gmsh.model.geo.addCurveLoop([115, -111, 3, 110], 118)
+gmsh.model.geo.addPlaneSurface([118], 119)
+gmsh.model.geo.addCurveLoop([111, 116, -112, -7], 120)
+gmsh.model.geo.addPlaneSurface([120], 121)
+gmsh.model.geo.addCurveLoop([112, 117, -113, -8], 122)
+gmsh.model.geo.addPlaneSurface([122], 123)
+gmsh.model.geo.addCurveLoop([114, -110, 5, 113], 124)
+gmsh.model.geo.addPlaneSurface([124], 125)
+gmsh.model.geo.addCurveLoop([115, 116, 117, 114], 126)
+gmsh.model.geo.addPlaneSurface([126], 127)
 
-factory.addSurfaceLoop([127, 119, 121, 123, 125, 11], 128)
-factory.addVolume([128], 129)
+gmsh.model.geo.addSurfaceLoop([127, 119, 121, 123, 125, 11], 128)
+gmsh.model.geo.addVolume([128], 129)
 
-ov2 = factory.extrude([ov[2]], 0, 0, 0.12)
+ov2 = gmsh.model.geo.extrude([ov[2]], 0, 0, 0.12)
 
-factory.mesh.setSize([(0,103), (0,105), (0,109), (0,102), (0,28),
-                      (0, 24), (0,6), (0,5)], lc * 3)
+gmsh.model.geo.mesh.setSize([(0,103), (0,105), (0,109), (0,102), (0,28),
+                             (0, 24), (0,6), (0,5)], lc * 3)
 
-model.addPhysicalGroup(3, [129,130], 1)
-model.setPhysicalName(3, 1, "The volume")
+gmsh.model.addPhysicalGroup(3, [129,130], 1)
+gmsh.model.setPhysicalName(3, 1, "The volume")
 
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 
 gmsh.write("t2.msh")
 
diff --git a/tutorial/julia/t3.jl b/tutorial/julia/t3.jl
index 72b830f155b7cf9c2d4954a1e01728a95919a5d4..d5cf6d295c15827eb4c998a60015f9267cf5c7a9 100644
--- a/tutorial/julia/t3.jl
+++ b/tutorial/julia/t3.jl
@@ -2,42 +2,39 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t3")
+gmsh.model.add("t3")
 
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-model.addPhysicalGroup(0, [1, 2], 1)
-model.addPhysicalGroup(1, [1, 2], 2)
-model.addPhysicalGroup(2, [1], 6)
-model.setPhysicalName(2, 6, "My surface")
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+gmsh.model.addPhysicalGroup(0, [1, 2], 1)
+gmsh.model.addPhysicalGroup(1, [1, 2], 2)
+gmsh.model.addPhysicalGroup(2, [1], 6)
+gmsh.model.setPhysicalName(2, 6, "My surface")
 
 h = 0.1
 angle = 90.
 
-ov = factory.extrude([(2,1)], 0, 0, h, [8,2], [0.5,1])
+ov = gmsh.model.geo.extrude([(2,1)], 0, 0, h, [8,2], [0.5,1])
 
-ov = factory.revolve([(2,28)], -0.1,0,0.1, 0,1,0, -pi/2, [7])
-ov = factory.twist([(2,50)], 0,0.15,0.25, -2*h,0,0, 1,0,0, angle*pi/180.,
-                   [10], [], true)
+ov = gmsh.model.geo.revolve([(2,28)], -0.1,0,0.1, 0,1,0, -pi/2, [7])
+ov = gmsh.model.geo.twist([(2,50)], 0,0.15,0.25, -2*h,0,0, 1,0,0,
+                          angle*pi/180., [10], [], true)
 
-model.addPhysicalGroup(3, [1, 2, ov[2][2]], 101)
+gmsh.model.addPhysicalGroup(3, [1, 2, ov[2][2]], 101)
 
-factory.synchronize()
-model.mesh.generate(3)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.generate(3)
 gmsh.write("t3.msh")
 gmsh.finalize()
diff --git a/tutorial/julia/t4.jl b/tutorial/julia/t4.jl
index 0c86cf9b5a33b0d1b445d5da7e40e34278eb9ee0..440aed85bd1771278ebcdc7ae35ef6957ceee47d 100644
--- a/tutorial/julia/t4.jl
+++ b/tutorial/julia/t4.jl
@@ -2,13 +2,10 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t4")
+gmsh.model.add("t4")
 
 cm = 1e-02
 e1 = 4.5 * cm; e2 = 6 * cm / 2; e3 =  5 * cm / 2
@@ -24,6 +21,7 @@ end
 ccos = (-h5*R1 + e2 * hypot(h5, hypot(e2, R1))) / (h5*h5 + e2*e2)
 ssin = sqrt(1 - ccos*ccos)
 
+factory = gmsh.model.geo
 factory.addPoint(-e1-e2, 0    , 0, Lc1, 1)
 factory.addPoint(-e1-e2, h1   , 0, Lc1, 2)
 factory.addPoint(-e3-r , h1   , 0, Lc2, 3)
@@ -93,7 +91,7 @@ factory.addPlaneSurface([23,21], 24)
 
 factory.synchronize()
 
-model.mesh.generate(2)
+gmsh.model.mesh.generate(2)
 
 gmsh.write("t4.msh")
 
diff --git a/tutorial/julia/t5.jl b/tutorial/julia/t5.jl
index 3e368152b1c3d6e5f93071b6521112f33cf610d6..7bbcbb5f63c05213ae0ae977f594f59c5d180abf 100644
--- a/tutorial/julia/t5.jl
+++ b/tutorial/julia/t5.jl
@@ -2,112 +2,108 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t5")
+gmsh.model.add("t5")
 
 lcar1 = .1
 lcar2 = .0005
 lcar3 = .055
 
-factory.addPoint(0.5,0.5,0.5, lcar2, 1)
-factory.addPoint(0.5,0.5,0, lcar1, 2)
-factory.addPoint(0,0.5,0.5, lcar1, 3)
-factory.addPoint(0,0,0.5, lcar1, 4)
-factory.addPoint(0.5,0,0.5, lcar1, 5)
-factory.addPoint(0.5,0,0, lcar1, 6)
-factory.addPoint(0,0.5,0, lcar1, 7)
-factory.addPoint(0,1,0, lcar1, 8)
-factory.addPoint(1,1,0, lcar1, 9)
-factory.addPoint(0,0,1, lcar1, 10)
-factory.addPoint(0,1,1, lcar1, 11)
-factory.addPoint(1,1,1, lcar1, 12)
-factory.addPoint(1,0,1, lcar1, 13)
-factory.addPoint(1,0,0, lcar1, 14)
-
-factory.addLine(8,9, 1);   factory.addLine(9,12, 2)
-factory.addLine(12,11, 3); factory.addLine(11,8, 4)
-factory.addLine(9,14, 5);  factory.addLine(14,13, 6)
-factory.addLine(13,12, 7); factory.addLine(11,10, 8)
-factory.addLine(10,13, 9); factory.addLine(10,4, 10)
-factory.addLine(4,5, 11);  factory.addLine(5,6, 12)
-factory.addLine(6,2, 13);  factory.addLine(2,1, 14)
-factory.addLine(1,3, 15);  factory.addLine(3,7, 16)
-factory.addLine(7,2, 17);  factory.addLine(3,4, 18)
-factory.addLine(5,1, 19);  factory.addLine(7,8, 20)
-factory.addLine(6,14, 21);
-
-factory.addCurveLoop([-11,-19,-15,-18], 22)
-factory.addPlaneSurface([22], 23)
-factory.addCurveLoop([16,17,14,15], 24)
-factory.addPlaneSurface([24], 25)
-factory.addCurveLoop([-17,20,1,5,-21,13], 26)
-factory.addPlaneSurface([26], 27)
-factory.addCurveLoop([-4,-1,-2,-3], 28)
-factory.addPlaneSurface([28], 29)
-factory.addCurveLoop([-7,2,-5,-6], 30)
-factory.addPlaneSurface([30], 31)
-factory.addCurveLoop([6,-9,10,11,12,21], 32)
-factory.addPlaneSurface([32], 33)
-factory.addCurveLoop([7,3,8,9], 34)
-factory.addPlaneSurface([34], 35)
-factory.addCurveLoop([-10,18,-16,-20,4,-8], 36)
-factory.addPlaneSurface([36], 37)
-factory.addCurveLoop([-14,-13,-12,19], 38)
-factory.addPlaneSurface([38], 39)
+gmsh.model.geo.addPoint(0.5,0.5,0.5, lcar2, 1)
+gmsh.model.geo.addPoint(0.5,0.5,0, lcar1, 2)
+gmsh.model.geo.addPoint(0,0.5,0.5, lcar1, 3)
+gmsh.model.geo.addPoint(0,0,0.5, lcar1, 4)
+gmsh.model.geo.addPoint(0.5,0,0.5, lcar1, 5)
+gmsh.model.geo.addPoint(0.5,0,0, lcar1, 6)
+gmsh.model.geo.addPoint(0,0.5,0, lcar1, 7)
+gmsh.model.geo.addPoint(0,1,0, lcar1, 8)
+gmsh.model.geo.addPoint(1,1,0, lcar1, 9)
+gmsh.model.geo.addPoint(0,0,1, lcar1, 10)
+gmsh.model.geo.addPoint(0,1,1, lcar1, 11)
+gmsh.model.geo.addPoint(1,1,1, lcar1, 12)
+gmsh.model.geo.addPoint(1,0,1, lcar1, 13)
+gmsh.model.geo.addPoint(1,0,0, lcar1, 14)
+
+gmsh.model.geo.addLine(8,9, 1);   gmsh.model.geo.addLine(9,12, 2)
+gmsh.model.geo.addLine(12,11, 3); gmsh.model.geo.addLine(11,8, 4)
+gmsh.model.geo.addLine(9,14, 5);  gmsh.model.geo.addLine(14,13, 6)
+gmsh.model.geo.addLine(13,12, 7); gmsh.model.geo.addLine(11,10, 8)
+gmsh.model.geo.addLine(10,13, 9); gmsh.model.geo.addLine(10,4, 10)
+gmsh.model.geo.addLine(4,5, 11);  gmsh.model.geo.addLine(5,6, 12)
+gmsh.model.geo.addLine(6,2, 13);  gmsh.model.geo.addLine(2,1, 14)
+gmsh.model.geo.addLine(1,3, 15);  gmsh.model.geo.addLine(3,7, 16)
+gmsh.model.geo.addLine(7,2, 17);  gmsh.model.geo.addLine(3,4, 18)
+gmsh.model.geo.addLine(5,1, 19);  gmsh.model.geo.addLine(7,8, 20)
+gmsh.model.geo.addLine(6,14, 21);
+
+gmsh.model.geo.addCurveLoop([-11,-19,-15,-18], 22)
+gmsh.model.geo.addPlaneSurface([22], 23)
+gmsh.model.geo.addCurveLoop([16,17,14,15], 24)
+gmsh.model.geo.addPlaneSurface([24], 25)
+gmsh.model.geo.addCurveLoop([-17,20,1,5,-21,13], 26)
+gmsh.model.geo.addPlaneSurface([26], 27)
+gmsh.model.geo.addCurveLoop([-4,-1,-2,-3], 28)
+gmsh.model.geo.addPlaneSurface([28], 29)
+gmsh.model.geo.addCurveLoop([-7,2,-5,-6], 30)
+gmsh.model.geo.addPlaneSurface([30], 31)
+gmsh.model.geo.addCurveLoop([6,-9,10,11,12,21], 32)
+gmsh.model.geo.addPlaneSurface([32], 33)
+gmsh.model.geo.addCurveLoop([7,3,8,9], 34)
+gmsh.model.geo.addPlaneSurface([34], 35)
+gmsh.model.geo.addCurveLoop([-10,18,-16,-20,4,-8], 36)
+gmsh.model.geo.addPlaneSurface([36], 37)
+gmsh.model.geo.addCurveLoop([-14,-13,-12,19], 38)
+gmsh.model.geo.addPlaneSurface([38], 39)
 
 shells = []
 
-# When the tag is not specified, a new one is automatically provided
-sl = factory.addSurfaceLoop([35,31,29,37,33,23,39,25,27])
+sl = gmsh.model.geo.addSurfaceLoop([35,31,29,37,33,23,39,25,27])
 push!(shells, sl)
 
 function cheeseHole(x, y, z, r, lc, shells)
-    p1 = factory.addPoint(x,  y,  z,   lc)
-    p2 = factory.addPoint(x+r,y,  z,   lc)
-    p3 = factory.addPoint(x,  y+r,z,   lc)
-    p4 = factory.addPoint(x,  y,  z+r, lc)
-    p5 = factory.addPoint(x-r,y,  z,   lc)
-    p6 = factory.addPoint(x,  y-r,z,   lc)
-    p7 = factory.addPoint(x,  y,  z-r, lc)
-
-    c1 = factory.addCircleArc(p2,p1,p7)
-    c2 = factory.addCircleArc(p7,p1,p5)
-    c3 = factory.addCircleArc(p5,p1,p4)
-    c4 = factory.addCircleArc(p4,p1,p2)
-    c5 = factory.addCircleArc(p2,p1,p3)
-    c6 = factory.addCircleArc(p3,p1,p5)
-    c7 = factory.addCircleArc(p5,p1,p6)
-    c8 = factory.addCircleArc(p6,p1,p2)
-    c9 = factory.addCircleArc(p7,p1,p3)
-    c10 = factory.addCircleArc(p3,p1,p4)
-    c11 = factory.addCircleArc(p4,p1,p6)
-    c12 = factory.addCircleArc(p6,p1,p7)
-
-    l1 = factory.addCurveLoop([c5,c10,c4])
-    l2 = factory.addCurveLoop([c9,-c5,c1])
-    l3 = factory.addCurveLoop([c12,-c8,-c1])
-    l4 = factory.addCurveLoop([c8,-c4,c11])
-    l5 = factory.addCurveLoop([-c10,c6,c3])
-    l6 = factory.addCurveLoop([-c11,-c3,c7])
-    l7 = factory.addCurveLoop([-c2,-c7,-c12])
-    l8 = factory.addCurveLoop([-c6,-c9,c2])
-
-    s1 = factory.addSurfaceFilling([l1])
-    s2 = factory.addSurfaceFilling([l2])
-    s3 = factory.addSurfaceFilling([l3])
-    s4 = factory.addSurfaceFilling([l4])
-    s5 = factory.addSurfaceFilling([l5])
-    s6 = factory.addSurfaceFilling([l6])
-    s7 = factory.addSurfaceFilling([l7])
-    s8 = factory.addSurfaceFilling([l8])
-
-    sl = factory.addSurfaceLoop([s1, s2, s3, s4, s5, s6, s7, s8])
-    v = factory.addVolume([sl])
+    p1 = gmsh.model.geo.addPoint(x,  y,  z,   lc)
+    p2 = gmsh.model.geo.addPoint(x+r,y,  z,   lc)
+    p3 = gmsh.model.geo.addPoint(x,  y+r,z,   lc)
+    p4 = gmsh.model.geo.addPoint(x,  y,  z+r, lc)
+    p5 = gmsh.model.geo.addPoint(x-r,y,  z,   lc)
+    p6 = gmsh.model.geo.addPoint(x,  y-r,z,   lc)
+    p7 = gmsh.model.geo.addPoint(x,  y,  z-r, lc)
+
+    c1 = gmsh.model.geo.addCircleArc(p2,p1,p7)
+    c2 = gmsh.model.geo.addCircleArc(p7,p1,p5)
+    c3 = gmsh.model.geo.addCircleArc(p5,p1,p4)
+    c4 = gmsh.model.geo.addCircleArc(p4,p1,p2)
+    c5 = gmsh.model.geo.addCircleArc(p2,p1,p3)
+    c6 = gmsh.model.geo.addCircleArc(p3,p1,p5)
+    c7 = gmsh.model.geo.addCircleArc(p5,p1,p6)
+    c8 = gmsh.model.geo.addCircleArc(p6,p1,p2)
+    c9 = gmsh.model.geo.addCircleArc(p7,p1,p3)
+    c10 = gmsh.model.geo.addCircleArc(p3,p1,p4)
+    c11 = gmsh.model.geo.addCircleArc(p4,p1,p6)
+    c12 = gmsh.model.geo.addCircleArc(p6,p1,p7)
+
+    l1 = gmsh.model.geo.addCurveLoop([c5,c10,c4])
+    l2 = gmsh.model.geo.addCurveLoop([c9,-c5,c1])
+    l3 = gmsh.model.geo.addCurveLoop([c12,-c8,-c1])
+    l4 = gmsh.model.geo.addCurveLoop([c8,-c4,c11])
+    l5 = gmsh.model.geo.addCurveLoop([-c10,c6,c3])
+    l6 = gmsh.model.geo.addCurveLoop([-c11,-c3,c7])
+    l7 = gmsh.model.geo.addCurveLoop([-c2,-c7,-c12])
+    l8 = gmsh.model.geo.addCurveLoop([-c6,-c9,c2])
+
+    s1 = gmsh.model.geo.addSurfaceFilling([l1])
+    s2 = gmsh.model.geo.addSurfaceFilling([l2])
+    s3 = gmsh.model.geo.addSurfaceFilling([l3])
+    s4 = gmsh.model.geo.addSurfaceFilling([l4])
+    s5 = gmsh.model.geo.addSurfaceFilling([l5])
+    s6 = gmsh.model.geo.addSurfaceFilling([l6])
+    s7 = gmsh.model.geo.addSurfaceFilling([l7])
+    s8 = gmsh.model.geo.addSurfaceFilling([l8])
+
+    sl = gmsh.model.geo.addSurfaceLoop([s1, s2, s3, s4, s5, s6, s7, s8])
+    v = gmsh.model.geo.addVolume([sl])
     push!(shells, sl)
     return v
 end
@@ -119,16 +115,16 @@ for t in 1:5
     x += 0.166
     z += 0.166
     v = cheeseHole(x, y, z, r, lcar3, shells)
-    model.addPhysicalGroup(3, [v], t)
+    gmsh.model.addPhysicalGroup(3, [v], t)
 end
 
-factory.addVolume(shells, 186);
+gmsh.model.geo.addVolume(shells, 186);
 
-model.addPhysicalGroup(3, [186], 10);
-factory.synchronize()
+gmsh.model.addPhysicalGroup(3, [186], 10);
+gmsh.model.geo.synchronize()
 gmsh.fltk.run()
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 gmsh.write("t5.msh")
 
 gmsh.finalize()
diff --git a/tutorial/python/t10.py b/tutorial/python/t10.py
index bdc4fe229faad979550d9e7226fddf04e65cbc3e..e00b3f76c6680976fb62a3225a28fd82d5a07d94 100644
--- a/tutorial/python/t10.py
+++ b/tutorial/python/t10.py
@@ -13,41 +13,38 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t10")
+gmsh.model.add("t10")
 
 # Let's create a simple rectangular geometry:
 lc = .15
-factory.addPoint(0.0,0.0,0, lc, 1)
-factory.addPoint(1,0.0,0, lc, 2)
-factory.addPoint(1,1,0, lc, 3)
-factory.addPoint(0,1,0, lc, 4)
-factory.addPoint(0.2,.5,0, lc, 5)
+gmsh.model.geo.addPoint(0.0,0.0,0, lc, 1)
+gmsh.model.geo.addPoint(1,0.0,0, lc, 2)
+gmsh.model.geo.addPoint(1,1,0, lc, 3)
+gmsh.model.geo.addPoint(0,1,0, lc, 4)
+gmsh.model.geo.addPoint(0.2,.5,0, lc, 5)
 
-factory.addLine(1,2, 1);
-factory.addLine(2,3, 2);
-factory.addLine(3,4, 3);
-factory.addLine(4,1, 4);
+gmsh.model.geo.addLine(1,2, 1);
+gmsh.model.geo.addLine(2,3, 2);
+gmsh.model.geo.addLine(3,4, 3);
+gmsh.model.geo.addLine(4,1, 4);
 
-factory.addCurveLoop([1,2,3,4], 5)
-factory.addPlaneSurface([5], 6)
+gmsh.model.geo.addCurveLoop([1,2,3,4], 5)
+gmsh.model.geo.addPlaneSurface([5], 6)
 
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
 # Say we would like to obtain mesh elements with size lc/30 near curve 2 and
 # point 5, and size lc elsewhere. To achieve this, we can use two fields:
 # "Distance", and "Threshold". We first define a Distance field (`Field[1]') on
 # points 5 and on curve 2. This field returns the distance to point 5 and to
 # (100 equidistant points on) curve 2.
-model.mesh.field.add("Distance", 1)
-model.mesh.field.setNumbers(1, "NodesList", [5])
-model.mesh.field.setNumber(1, "NNodesByEdge", 100)
-model.mesh.field.setNumbers(1, "EdgesList", [2])
+gmsh.model.mesh.field.add("Distance", 1)
+gmsh.model.mesh.field.setNumbers(1, "NodesList", [5])
+gmsh.model.mesh.field.setNumber(1, "NNodesByEdge", 100)
+gmsh.model.mesh.field.setNumbers(1, "EdgesList", [2])
 
 # We then define a `Threshold' field, which uses the return value of the
 # `Distance' field 1 in order to define a simple change in element size
@@ -60,48 +57,48 @@ model.mesh.field.setNumbers(1, "EdgesList", [2])
 # LcMin -o----------------/
 #        |                |       |
 #      Point           DistMin DistMax
-model.mesh.field.add("Threshold", 2);
-model.mesh.field.setNumber(2, "IField", 1);
-model.mesh.field.setNumber(2, "LcMin", lc / 30)
-model.mesh.field.setNumber(2, "LcMax", lc)
-model.mesh.field.setNumber(2, "DistMin", 0.15)
-model.mesh.field.setNumber(2, "DistMax", 0.5)
+gmsh.model.mesh.field.add("Threshold", 2);
+gmsh.model.mesh.field.setNumber(2, "IField", 1);
+gmsh.model.mesh.field.setNumber(2, "LcMin", lc / 30)
+gmsh.model.mesh.field.setNumber(2, "LcMax", lc)
+gmsh.model.mesh.field.setNumber(2, "DistMin", 0.15)
+gmsh.model.mesh.field.setNumber(2, "DistMax", 0.5)
 
 # Say we want to modulate the mesh element sizes using a mathematical function
 # of the spatial coordinates. We can do this with the MathEval field:
-model.mesh.field.add("MathEval", 3)
-model.mesh.field.setString(3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101")
+gmsh.model.mesh.field.add("MathEval", 3)
+gmsh.model.mesh.field.setString(3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101")
 
 # We could also combine MathEval with values coming from other fields. For
 # example, let's define a `Distance' field around point 1
-model.mesh.field.add("Distance", 4)
-model.mesh.field.setNumbers(4, "NodesList", [1])
+gmsh.model.mesh.field.add("Distance", 4)
+gmsh.model.mesh.field.setNumbers(4, "NodesList", [1])
 
 # We can then create a `MathEval' field with a function that depends on the
 # return value of the `Distance' field 4, i.e., depending on the distance to
 # point 1 (here using a cubic law, with minimum element size = lc / 100)
-model.mesh.field.add("MathEval", 5);
-model.mesh.field.setString(5, "F", "F4^3 + " + str(lc / 100))
+gmsh.model.mesh.field.add("MathEval", 5);
+gmsh.model.mesh.field.setString(5, "F", "F4^3 + " + str(lc / 100))
 
 # We could also use a `Box' field to impose a step change in element sizes
 # inside a box
-model.mesh.field.add("Box", 6)
-model.mesh.field.setNumber(6, "VIn", lc / 15)
-model.mesh.field.setNumber(6, "VOut", lc)
-model.mesh.field.setNumber(6, "XMin", 0.3)
-model.mesh.field.setNumber(6, "XMax", 0.6)
-model.mesh.field.setNumber(6, "YMin", 0.3)
-model.mesh.field.setNumber(6, "YMax", 0.6)
+gmsh.model.mesh.field.add("Box", 6)
+gmsh.model.mesh.field.setNumber(6, "VIn", lc / 15)
+gmsh.model.mesh.field.setNumber(6, "VOut", lc)
+gmsh.model.mesh.field.setNumber(6, "XMin", 0.3)
+gmsh.model.mesh.field.setNumber(6, "XMax", 0.6)
+gmsh.model.mesh.field.setNumber(6, "YMin", 0.3)
+gmsh.model.mesh.field.setNumber(6, "YMax", 0.6)
 
 # Many other types of fields are available: see the reference manual for a
 # complete list. You can also create fields directly in the graphical user
 # interface by selecting `Define->Fields' in the `Mesh' module.
 
 # Finally, let's use the minimum of all the fields as the background mesh field:
-model.mesh.field.add("Min", 7)
-model.mesh.field.setNumbers(7, "FieldsList", [2, 3, 5, 6])
+gmsh.model.mesh.field.add("Min", 7)
+gmsh.model.mesh.field.setNumbers(7, "FieldsList", [2, 3, 5, 6])
 
-model.mesh.field.setAsBackgroundMesh(7)
+gmsh.model.mesh.field.setAsBackgroundMesh(7)
 
 # To determine the size of mesh elements, Gmsh locally computes the minimum of
 #
@@ -130,7 +127,7 @@ gmsh.option.setNumber("Mesh.CharacteristicLengthFromCurvature", 0)
 
 # This will prevent over-refinement due to small mesh sizes on the boundary.
 
-model.mesh.generate(2)
+gmsh.model.mesh.generate(2)
 gmsh.write("t10.msh")
 
 # gmsh.fltk.run()
diff --git a/tutorial/python/t11.py b/tutorial/python/t11.py
index f179e4d968a6a5845969f6725fb1fa8f0432f153..c61705b8c89e8218eb3531127b95f52c0dee08ec 100644
--- a/tutorial/python/t11.py
+++ b/tutorial/python/t11.py
@@ -8,9 +8,6 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
@@ -21,28 +18,28 @@ gmsh.model.add("t11")
 # meshes can be recombined in the same way. Let's define a simple geometry with
 # an analytical mesh size field:
 
-p1 = factory.addPoint(-1.25, -.5, 0)
-p2 = factory.addPoint(1.25, -.5, 0)
-p3 = factory.addPoint(1.25, 1.25, 0)
-p4 = factory.addPoint(-1.25, 1.25, 0)
+p1 = gmsh.model.geo.addPoint(-1.25, -.5, 0)
+p2 = gmsh.model.geo.addPoint(1.25, -.5, 0)
+p3 = gmsh.model.geo.addPoint(1.25, 1.25, 0)
+p4 = gmsh.model.geo.addPoint(-1.25, 1.25, 0)
 
-l1 = factory.addLine(p1, p2)
-l2 = factory.addLine(p2, p3)
-l3 = factory.addLine(p3, p4)
-l4 = factory.addLine(p4, p1)
+l1 = gmsh.model.geo.addLine(p1, p2)
+l2 = gmsh.model.geo.addLine(p2, p3)
+l3 = gmsh.model.geo.addLine(p3, p4)
+l4 = gmsh.model.geo.addLine(p4, p1)
 
-cl = factory.addCurveLoop([l1, l2, l3, l4])
-pl = factory.addPlaneSurface([cl])
+cl = gmsh.model.geo.addCurveLoop([l1, l2, l3, l4])
+pl = gmsh.model.geo.addPlaneSurface([cl])
 
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
-field = model.mesh.field
+field = gmsh.model.mesh.field
 field.add("MathEval", 1)
 field.setString(1, "F", "0.01*(1.0+30.*(y-x*x)*(y-x*x) + (1-x)*(1-x))")
 field.setAsBackgroundMesh(1)
 
 # To generate quadrangles instead of triangles, we can simply add
-model.mesh.setRecombine(2, pl)
+gmsh.model.mesh.setRecombine(2, pl)
 
 # If we'd had several surfaces, we could have used the global option
 # "Mesh.RecombineAll":
@@ -82,7 +79,7 @@ model.mesh.setRecombine(2, pl)
 #
 # gmsh.option.setNumber("Mesh.SubdivisionAlgorithm", 1)
 
-model.mesh.generate(2)
+gmsh.model.mesh.generate(2)
 
 # Note that you could also apply the recombination algorithm and/or the
 # subdivision step explicitly after meshing, as follows:
diff --git a/tutorial/python/t12.py b/tutorial/python/t12.py
index f928cebdfe94cb1a96b9712cf5160059b564ffd9..20ca52fc5b82302ad2b7fd99554fcfd7d3b61938 100644
--- a/tutorial/python/t12.py
+++ b/tutorial/python/t12.py
@@ -8,9 +8,6 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 # "Compound" meshing constraints allow to generate meshes across surface
 # boundaries, which can be useful e.g. for imported CAD models (e.g. STEP) with
 # undesired small features.
@@ -45,49 +42,52 @@ gmsh.option.setNumber("General.Terminal", 1)
 
 lc = 0.1
 
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(1, 0, 0, lc, 2)
-factory.addPoint(1, 1, 0.5, lc, 3)
-factory.addPoint(0, 1, 0.4, lc, 4)
-factory.addPoint(0.3, 0.2, 0, lc, 5)
-factory.addPoint(0, 0.01, 0.01, lc, 6)
-factory.addPoint(0, 0.02, 0.02, lc, 7)
-factory.addPoint(1, 0.05, 0.02, lc, 8)
-factory.addPoint(1, 0.32, 0.02, lc, 9)
-
-factory.addLine(1, 2, 1)
-factory.addLine(2, 8, 2)
-factory.addLine(8, 9, 3)
-factory.addLine(9, 3, 4)
-factory.addLine(3, 4, 5)
-factory.addLine(4, 7, 6)
-factory.addLine(7, 6, 7)
-factory.addLine(6, 1, 8)
-factory.addSpline([7, 5, 9], 9)
-factory.addLine(6, 8, 10)
-
-factory.addCurveLoop([5, 6, 9, 4], 11)
-factory.addSurfaceFilling([11], 1)
-
-factory.addCurveLoop([-9, 3, 10, 7], 13)
-factory.addSurfaceFilling([13], 5)
-
-factory.addCurveLoop([-10, 2, 1, 8], 15)
-factory.addSurfaceFilling([15], 10)
-
-factory.synchronize()
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(1, 0, 0, lc, 2)
+gmsh.model.geo.addPoint(1, 1, 0.5, lc, 3)
+gmsh.model.geo.addPoint(0, 1, 0.4, lc, 4)
+gmsh.model.geo.addPoint(0.3, 0.2, 0, lc, 5)
+gmsh.model.geo.addPoint(0, 0.01, 0.01, lc, 6)
+gmsh.model.geo.addPoint(0, 0.02, 0.02, lc, 7)
+gmsh.model.geo.addPoint(1, 0.05, 0.02, lc, 8)
+gmsh.model.geo.addPoint(1, 0.32, 0.02, lc, 9)
+
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(2, 8, 2)
+gmsh.model.geo.addLine(8, 9, 3)
+gmsh.model.geo.addLine(9, 3, 4)
+gmsh.model.geo.addLine(3, 4, 5)
+gmsh.model.geo.addLine(4, 7, 6)
+gmsh.model.geo.addLine(7, 6, 7)
+gmsh.model.geo.addLine(6, 1, 8)
+gmsh.model.geo.addSpline([7, 5, 9], 9)
+gmsh.model.geo.addLine(6, 8, 10)
+
+gmsh.model.geo.addCurveLoop([5, 6, 9, 4], 11)
+gmsh.model.geo.addSurfaceFilling([11], 1)
+
+gmsh.model.geo.addCurveLoop([-9, 3, 10, 7], 13)
+gmsh.model.geo.addSurfaceFilling([13], 5)
+
+gmsh.model.geo.addCurveLoop([-10, 2, 1, 8], 15)
+gmsh.model.geo.addSurfaceFilling([15], 10)
+
+gmsh.model.geo.synchronize()
 
 # Treat curves 2, 3 and 4 as a single curve when meshing (i.e. mesh across
 # points 6 and 7)
-model.mesh.setCompound(1, [2, 3, 4])
+gmsh.model.mesh.setCompound(1, [2, 3, 4])
 
 # Idem with curves 6, 7 and 8
-model.mesh.setCompound(1, [6, 7, 8])
+gmsh.model.mesh.setCompound(1, [6, 7, 8])
 
 # Treat surfaces 1, 5 and 10 as a single surface when meshing (i.e. mesh across
 # curves 9 and 10)
-model.mesh.setCompound(2, [1, 5, 10])
+gmsh.model.mesh.setCompound(2, [1, 5, 10])
+
+gmsh.model.mesh.generate(2)
+gmsh.write('t12.msh')
 
-gmsh.fltk.run()
+# gmsh.fltk.run()
 
 gmsh.finalize()
diff --git a/tutorial/python/t13.py b/tutorial/python/t13.py
index 5ff968501e478b6c841b760a2b160ff7dad4ef55..b0de023edd7eb92e1c568eec45dfd601c87e6d8d 100644
--- a/tutorial/python/t13.py
+++ b/tutorial/python/t13.py
@@ -61,6 +61,7 @@ else:
 gmsh.model.mesh.field.setAsBackgroundMesh(f)
 
 gmsh.model.mesh.generate(3)
+gmsh.write('t13.msh')
 
 # gmsh.fltk.run()
 
diff --git a/tutorial/python/t15.py b/tutorial/python/t15.py
index 6174aadb452d5d22ef1c86aa6e87f93e040859ba..76648972fe1f4658fd086aae4afbd3ffc2fdec9e 100644
--- a/tutorial/python/t15.py
+++ b/tutorial/python/t15.py
@@ -16,80 +16,77 @@
 
 import gmsh
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
 # Copied from t1.py...
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
 
 # We change the mesh size to generate a coarser mesh
 lc = lc * 4
-factory.mesh.setSize([(0, 1), (0, 2), (0, 3), (0, 4)], lc)
+gmsh.model.geo.mesh.setSize([(0, 1), (0, 2), (0, 3), (0, 4)], lc)
 
 # We define a new point
-factory.addPoint(0.02, 0.02, 0., lc, 5)
+gmsh.model.geo.addPoint(0.02, 0.02, 0., lc, 5)
 
 # We have to synchronize before embedding entites:
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
 # One can force this point to be included ("embedded") in the 2D mesh, using the
 # `embed()' function:
-model.mesh.embed(0, [5], 2, 1)
+gmsh.model.mesh.embed(0, [5], 2, 1)
 
 # In the same way, one use `embed()' to force a curve to be embedded in the 2D
 # mesh:
-factory.addPoint(0.02, 0.12, 0., lc, 6)
-factory.addPoint(0.04, 0.18, 0., lc, 7)
-factory.addLine(6, 7, 5)
+gmsh.model.geo.addPoint(0.02, 0.12, 0., lc, 6)
+gmsh.model.geo.addPoint(0.04, 0.18, 0., lc, 7)
+gmsh.model.geo.addLine(6, 7, 5)
 
-factory.synchronize()
-model.mesh.embed(1, [5], 2, 1)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.embed(1, [5], 2, 1)
 
 # Points and curves can also be embedded in volumes
-factory.extrude([(2, 1)], 0, 0, 0.1)
+gmsh.model.geo.extrude([(2, 1)], 0, 0, 0.1)
 
-p = factory.addPoint(0.07, 0.15, 0.025, lc)
+p = gmsh.model.geo.addPoint(0.07, 0.15, 0.025, lc)
 
-factory.synchronize()
-model.mesh.embed(0, [p], 3, 1)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.embed(0, [p], 3, 1)
 
-factory.addPoint(0.025, 0.15, 0.025, lc, p+1)
-l = factory.addLine(7, p+1)
+gmsh.model.geo.addPoint(0.025, 0.15, 0.025, lc, p+1)
+l = gmsh.model.geo.addLine(7, p+1)
 
-factory.synchronize()
-model.mesh.embed(1, [l], 3, 1)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.embed(1, [l], 3, 1)
 
 # Finally, we can also embed a surface in a volume:
-factory.addPoint(0.02, 0.12, 0.05, lc, p+2)
-factory.addPoint(0.04, 0.12, 0.05, lc, p+3)
-factory.addPoint(0.04, 0.18, 0.05, lc, p+4)
-factory.addPoint(0.02, 0.18, 0.05, lc, p+5)
+gmsh.model.geo.addPoint(0.02, 0.12, 0.05, lc, p+2)
+gmsh.model.geo.addPoint(0.04, 0.12, 0.05, lc, p+3)
+gmsh.model.geo.addPoint(0.04, 0.18, 0.05, lc, p+4)
+gmsh.model.geo.addPoint(0.02, 0.18, 0.05, lc, p+5)
 
-factory.addLine(p+2, p+3, l+1)
-factory.addLine(p+3, p+4, l+2)
-factory.addLine(p+4, p+5, l+3)
-factory.addLine(p+5, p+2, l+4)
+gmsh.model.geo.addLine(p+2, p+3, l+1)
+gmsh.model.geo.addLine(p+3, p+4, l+2)
+gmsh.model.geo.addLine(p+4, p+5, l+3)
+gmsh.model.geo.addLine(p+5, p+2, l+4)
 
-ll = factory.addCurveLoop([l+1, l+2, l+3, l+4])
-s = factory.addPlaneSurface([ll])
+ll = gmsh.model.geo.addCurveLoop([l+1, l+2, l+3, l+4])
+s = gmsh.model.geo.addPlaneSurface([ll])
 
-factory.synchronize()
-model.mesh.embed(2, [s], 3, 1)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.embed(2, [s], 3, 1)
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 
 gmsh.write("t15.msh")
 
diff --git a/tutorial/python/t16.py b/tutorial/python/t16.py
index 675157de460ad35815ef5072a50996a763cd2ca2..f551cb2df8af5ba5058359682a1ae742c89245d2 100644
--- a/tutorial/python/t16.py
+++ b/tutorial/python/t16.py
@@ -13,13 +13,10 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.occ
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t16")
+gmsh.model.add("t16")
 
 # Let's build the same model as in `t5.geo', but using constructive solid
 # geometry.
@@ -28,11 +25,11 @@ model.add("t16")
 gmsh.logger.start()
 
 # We first create two cubes:
-factory.addBox(0,0,0, 1,1,1, 1)
-factory.addBox(0,0,0, 0.5,0.5,0.5, 2)
+gmsh.model.occ.addBox(0,0,0, 1,1,1, 1)
+gmsh.model.occ.addBox(0,0,0, 0.5,0.5,0.5, 2)
 
 # We apply a boolean difference to create the "cube minus one eigth" shape:
-factory.cut([(3,1)], [(3,2)], 3)
+gmsh.model.occ.cut([(3,1)], [(3,2)], 3)
 
 # Boolean operations with OpenCASCADE always create new entities. By default the
 # extra arguments `removeObject' and `removeTool' in `cut()' are set to `True',
@@ -44,14 +41,14 @@ holes = []
 for t in range(1, 6):
     x += 0.166
     z += 0.166
-    factory.addSphere(x,y,z,r, 3 + t)
+    gmsh.model.occ.addSphere(x,y,z,r, 3 + t)
     holes.append((3, 3 + t))
 
 # If we had wanted five empty holes we would have used `cut()' again. Here we
 # want five spherical inclusions, whose mesh should be conformal with the mesh
 # of the cube: we thus use `fragment()', which intersects all volumes in a
 # conformal manner (without creating duplicate interfaces):
-ov, ovv = factory.fragment([(3,3)], holes)
+ov, ovv = gmsh.model.occ.fragment([(3,3)], holes)
 
 # ov contains all the generated entities of the same dimension as the input
 # entities:
@@ -64,7 +61,7 @@ print("before/after fragment relations:")
 for e in zip([(3,3)] + holes, ovv):
     print("parent " + str(e[0]) + " -> child " + str(e[1]))
 
-factory.synchronize()
+gmsh.model.occ.synchronize()
 
 # When the boolean operation leads to simple modifications of entities, and if
 # one deletes the original entities, Gmsh tries to assign the same tag to the
@@ -94,18 +91,18 @@ lcar2 = .0005
 lcar3 = .055
 
 # Assign a mesh size to all the points:
-model.mesh.setSize(model.getEntities(0), lcar1)
+gmsh.model.mesh.setSize(gmsh.model.getEntities(0), lcar1)
 
 # Override this constraint on the points of the five spheres:
-model.mesh.setSize(model.getBoundary(holes, False, False, True), lcar3)
+gmsh.model.mesh.setSize(gmsh.model.getBoundary(holes, False, False, True), lcar3)
 
 # Select the corner point by searching for it geometrically:
 eps = 1e-3
-ov = model.getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
-                                    0.5+eps, 0.5+eps, 0.5+eps, 0)
-model.mesh.setSize(ov, lcar2)
+ov = gmsh.model.getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
+                                         0.5+eps, 0.5+eps, 0.5+eps, 0)
+gmsh.model.mesh.setSize(ov, lcar2)
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 
 gmsh.write("t16.msh")
 
diff --git a/tutorial/python/t2.py b/tutorial/python/t2.py
index dba1e30924f86be53809674c5a860f751a6fb207..b295dcfbed6e2ad8887be2fc773095d2829c6ae0 100644
--- a/tutorial/python/t2.py
+++ b/tutorial/python/t2.py
@@ -10,37 +10,33 @@ import gmsh
 import sys
 import math
 
-# We start by giving some nice shortcuts for some namespaces
-model = gmsh.model
-factory = model.geo
-
 # If sys.argv is passed to gmsh.initialize(), Gmsh will parse the command line
 # in the same way as the standalone Gmsh app:
 gmsh.initialize(sys.argv)
 
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t2")
+gmsh.model.add("t2")
 
 # Copied from t1.py...
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-model.addPhysicalGroup(0, [1, 2, 4], 5)
-ps = model.addPhysicalGroup(2, [1])
-model.setPhysicalName(2, ps, "My surface")
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+gmsh.model.addPhysicalGroup(0, [1, 2, 4], 5)
+ps = gmsh.model.addPhysicalGroup(2, [1])
+gmsh.model.setPhysicalName(2, ps, "My surface")
 
 # We can then add new points and curves in the same way as we did in `t1.py':
-factory.addPoint(0, .4, 0, lc, 5)
-factory.addLine(4, 5, 5)
+gmsh.model.geo.addPoint(0, .4, 0, lc, 5)
+gmsh.model.geo.addLine(4, 5, 5)
 
 # But Gmsh also provides tools to transform (translate, rotate, etc.)
 # elementary entities or copies of elementary entities.  Geometrical
@@ -48,11 +44,11 @@ factory.addLine(4, 5, 5)
 # contains the list of entities, represented by (dimension, tag) pairs.  For
 # example, the point 5 (dimension=0, tag=5) can be moved by 0.02 to the left
 # (dx=-0.02, dy=0, dz=0) with
-factory.translate([(0, 5)], -0.02, 0, 0)
+gmsh.model.geo.translate([(0, 5)], -0.02, 0, 0)
 
 # And it can be further rotated by -Pi/4 around (0, 0.3, 0) (with the rotation
 # along the z axis) with:
-factory.rotate([(0, 5)], 0,0.3,0, 0,0,1, -math.pi/4)
+gmsh.model.geo.rotate([(0, 5)], 0,0.3,0, 0,0,1, -math.pi/4)
 
 # Note that there are no units in Gmsh: coordinates are just numbers - it's
 # up to the user to associate a meaning to them.
@@ -60,20 +56,20 @@ factory.rotate([(0, 5)], 0,0.3,0, 0,0,1, -math.pi/4)
 # Point 3 can be duplicated and translated by 0.05 along the y axis by using the
 # copy() function, which takes a vector of (dim, tag) pairs as input, and
 # returns another vector of (dim, tag) pairs:
-ov = factory.copy([(0, 3)])
-factory.translate(ov, 0, 0.05, 0)
+ov = gmsh.model.geo.copy([(0, 3)])
+gmsh.model.geo.translate(ov, 0, 0.05, 0)
 
 # The new point tag is available in ov[0][1], and can be used to create new
 # lines:
-factory.addLine(3, ov[0][1], 7)
-factory.addLine(ov[0][1], 5, 8)
-factory.addCurveLoop([5,-8,-7,3], 10)
-factory.addPlaneSurface([10], 11)
+gmsh.model.geo.addLine(3, ov[0][1], 7)
+gmsh.model.geo.addLine(ov[0][1], 5, 8)
+gmsh.model.geo.addCurveLoop([5,-8,-7,3], 10)
+gmsh.model.geo.addPlaneSurface([10], 11)
 
 # In the same way, we can translate copies of the two surfaces 1 and 11 to the
 # right with the following command:
-ov = factory.copy([(2, 1), (2, 11)])
-factory.translate(ov, 0.12, 0, 0)
+ov = gmsh.model.geo.copy([(2, 1), (2, 11)])
+gmsh.model.geo.translate(ov, 0.12, 0, 0)
 
 print "New surfaces " + str(ov[0][1]) + " and " + str(ov[1][1])
 
@@ -81,38 +77,38 @@ print "New surfaces " + str(ov[0][1]) + " and " + str(ov[1][1])
 # one defines curve loops to build surfaces, one has to define surface loops
 # (i.e. `shells') to build volumes. The following volume does not have holes and
 # thus consists of a single surface loop:
-factory.addPoint(0., 0.3, 0.12, lc, 100)
-factory.addPoint(0.1, 0.3, 0.12, lc, 101)
-factory.addPoint(0.1, 0.35, 0.12, lc, 102)
+gmsh.model.geo.addPoint(0., 0.3, 0.12, lc, 100)
+gmsh.model.geo.addPoint(0.1, 0.3, 0.12, lc, 101)
+gmsh.model.geo.addPoint(0.1, 0.35, 0.12, lc, 102)
 
 # We would like to retrieve the coordinates of point 5 to create point 103, so
 # we synchronize the model, and use `getValue()'
-factory.synchronize()
-xyz = model.getValue(0, 5, [])
-factory.addPoint(xyz[0], xyz[1], 0.12, lc, 103)
-
-factory.addLine(4, 100, 110)
-factory.addLine(3, 101, 111)
-factory.addLine(6, 102, 112)
-factory.addLine(5, 103, 113)
-factory.addLine(103, 100, 114)
-factory.addLine(100, 101, 115)
-factory.addLine(101, 102, 116)
-factory.addLine(102, 103, 117)
-
-factory.addCurveLoop([115, -111, 3, 110], 118)
-factory.addPlaneSurface([118], 119)
-factory.addCurveLoop([111, 116, -112, -7], 120)
-factory.addPlaneSurface([120], 121)
-factory.addCurveLoop([112, 117, -113, -8], 122)
-factory.addPlaneSurface([122], 123)
-factory.addCurveLoop([114, -110, 5, 113], 124)
-factory.addPlaneSurface([124], 125)
-factory.addCurveLoop([115, 116, 117, 114], 126)
-factory.addPlaneSurface([126], 127)
-
-factory.addSurfaceLoop([127, 119, 121, 123, 125, 11], 128)
-factory.addVolume([128], 129)
+gmsh.model.geo.synchronize()
+xyz = gmsh.model.getValue(0, 5, [])
+gmsh.model.geo.addPoint(xyz[0], xyz[1], 0.12, lc, 103)
+
+gmsh.model.geo.addLine(4, 100, 110)
+gmsh.model.geo.addLine(3, 101, 111)
+gmsh.model.geo.addLine(6, 102, 112)
+gmsh.model.geo.addLine(5, 103, 113)
+gmsh.model.geo.addLine(103, 100, 114)
+gmsh.model.geo.addLine(100, 101, 115)
+gmsh.model.geo.addLine(101, 102, 116)
+gmsh.model.geo.addLine(102, 103, 117)
+
+gmsh.model.geo.addCurveLoop([115, -111, 3, 110], 118)
+gmsh.model.geo.addPlaneSurface([118], 119)
+gmsh.model.geo.addCurveLoop([111, 116, -112, -7], 120)
+gmsh.model.geo.addPlaneSurface([120], 121)
+gmsh.model.geo.addCurveLoop([112, 117, -113, -8], 122)
+gmsh.model.geo.addPlaneSurface([122], 123)
+gmsh.model.geo.addCurveLoop([114, -110, 5, 113], 124)
+gmsh.model.geo.addPlaneSurface([124], 125)
+gmsh.model.geo.addCurveLoop([115, 116, 117, 114], 126)
+gmsh.model.geo.addPlaneSurface([126], 127)
+
+gmsh.model.geo.addSurfaceLoop([127, 119, 121, 123, 125, 11], 128)
+gmsh.model.geo.addVolume([128], 129)
 
 # When a volume can be extruded from a surface, it is usually easier to use the
 # `extrude()' function directly instead of creating all the points, curves and
@@ -121,22 +117,22 @@ factory.addVolume([128], 129)
 # needed points, curves and surfaces). As expected, the function takes a vector
 # of (dim, tag) pairs as input as well as the translation vector, and returns a
 # vector of (dim, tag) pairs as output:
-ov2 = factory.extrude([ov[1]], 0, 0, 0.12)
+ov2 = gmsh.model.geo.extrude([ov[1]], 0, 0, 0.12)
 
 # Mesh sizes associated to geometrical points can be set by passing a vector of
 # (dim, tag) pairs for the corresponding points:
-factory.mesh.setSize([(0,103), (0,105), (0,109), (0,102), (0,28),
-                      (0, 24), (0,6), (0,5)], lc * 3)
+gmsh.model.geo.mesh.setSize([(0,103), (0,105), (0,109), (0,102), (0,28),
+                             (0, 24), (0,6), (0,5)], lc * 3)
 
 # We finally group volumes 129 and 130 in a single physical group with tag `1'
 # and name "The volume":
-model.addPhysicalGroup(3, [129,130], 1)
-model.setPhysicalName(3, 1, "The volume")
+gmsh.model.addPhysicalGroup(3, [129,130], 1)
+gmsh.model.setPhysicalName(3, 1, "The volume")
 
 # We finish by synchronizing the data from the built-in geometry kernel with the
 # Gmsh model, and by generating and saving the mesh:
-factory.synchronize()
-model.mesh.generate(3)
+gmsh.model.geo.synchronize()
+gmsh.model.mesh.generate(3)
 gmsh.write("t2.msh")
 
 # Note that, if the transformation tools are handy to create complex geometries,
diff --git a/tutorial/python/t3.py b/tutorial/python/t3.py
index 10195c9dbf67660b2ec75dc69ae6f68b74b5e303..88960d2ea46044e0ca419a790afd39ef2d2262fb 100644
--- a/tutorial/python/t3.py
+++ b/tutorial/python/t3.py
@@ -9,29 +9,26 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t3")
+gmsh.model.add("t3")
 
 # Copied from t1.py...
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-model.addPhysicalGroup(1, [1, 2, 4], 5)
-ps = model.addPhysicalGroup(2, [1])
-model.setPhysicalName(2, ps, "My surface")
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+gmsh.model.addPhysicalGroup(1, [1, 2, 4], 5)
+ps = gmsh.model.addPhysicalGroup(2, [1])
+gmsh.model.setPhysicalName(2, ps, "My surface")
 
 # As in `t2.py', we plan to perform an extrusion along the z axis.  But here,
 # instead of only extruding the geometry, we also want to extrude the 2D
@@ -43,13 +40,13 @@ model.setPhysicalName(2, ps, "My surface")
 
 h = 0.1
 angle = 90.
-ov = factory.extrude([(2,1)], 0, 0, h, [8,2], [0.5,1])
+ov = gmsh.model.geo.extrude([(2,1)], 0, 0, h, [8,2], [0.5,1])
 
 # The extrusion can also be performed with a rotation instead of a translation,
 # and the resulting mesh can be recombined into prisms (we use only one layer
 # here, with 7 subdivisions). All rotations are specified by an an axis point
 # (-0.1, 0, 0.1), an axis direction (0, 1, 0), and a rotation angle (-Pi/2):
-ov = factory.revolve([(2,28)], -0.1,0,0.1, 0,1,0, -math.pi/2, [7])
+ov = gmsh.model.geo.revolve([(2,28)], -0.1,0,0.1, 0,1,0, -math.pi/2, [7])
 
 # Using the built-in geometry kernel, only rotations with angles < Pi are
 # supported. To do a full turn, you will thus need to apply at least 3
@@ -59,10 +56,10 @@ ov = factory.revolve([(2,28)], -0.1,0,0.1, 0,1,0, -math.pi/2, [7])
 # also be combined to form a "twist".  The last (optional) argument for the
 # extrude() and twist() functions specifies whether the extruded mesh should be
 # recombined or not.
-ov = factory.twist([(2,50)], 0,0.15,0.25, -2*h,0,0, 1,0,0, angle*math.pi/180.,
-                   [10], [], True)
+ov = gmsh.model.geo.twist([(2,50)], 0,0.15,0.25, -2*h,0,0, 1,0,0,
+                          angle*math.pi/180., [10], [], True)
 
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
 # All the extrusion functions return a vector of extruded entities: the "top" of
 # the extruded surface (in `ov[0]'), the newly created volume (in `ov[1]') and
@@ -70,9 +67,9 @@ factory.synchronize()
 
 # We can then define a new physical volume (with tag 101) to group all the
 # elementary volumes:
-model.addPhysicalGroup(3, [1, 2, ov[1][1]], 101)
+gmsh.model.addPhysicalGroup(3, [1, 2, ov[1][1]], 101)
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 gmsh.write("t3.msh")
 
 # Let us now change some options... Since all interactive options are accessible
diff --git a/tutorial/python/t4.py b/tutorial/python/t4.py
index 2fd41252cd566c9f50e531ad77c30414a7b2e9f4..291717ca71903a6dd7f169fa6595f0c688d312b7 100644
--- a/tutorial/python/t4.py
+++ b/tutorial/python/t4.py
@@ -9,13 +9,10 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t4")
+gmsh.model.add("t4")
 
 cm = 1e-02
 e1 = 4.5 * cm; e2 = 6 * cm / 2; e3 =  5 * cm / 2
@@ -30,7 +27,9 @@ def hypot(a, b):
 ccos = (-h5*R1 + e2 * hypot(h5, hypot(e2, R1))) / (h5*h5 + e2*e2)
 ssin = math.sqrt(1 - ccos*ccos)
 
-# We start by defining some points and some lines:
+# We start by defining some points and some lines. To make the code shorter we
+# can redefine a namespace:
+factory = gmsh.model.geo
 factory.addPoint(-e1-e2, 0    , 0, Lc1, 1)
 factory.addPoint(-e1-e2, h1   , 0, Lc1, 2)
 factory.addPoint(-e3-r , h1   , 0, Lc2, 3)
@@ -160,7 +159,7 @@ gmsh.model.setColor([(2, 24)], 160, 32, 240) # Purple
 gmsh.model.setColor([(1, i) for i in range(1, 15)], 255, 0, 0) # Red
 gmsh.model.setColor([(1, i) for i in range(15, 21)], 255, 255, 0) # Yellow
 
-model.mesh.generate(2)
+gmsh.model.mesh.generate(2)
 
 gmsh.write("t4.msh")
 
diff --git a/tutorial/python/t5.py b/tutorial/python/t5.py
index c6d1a951883f5b2042b1e49bada462500e320b20..1d04488ee709ae4a8437a74c0e2fd7cfeb81b361 100644
--- a/tutorial/python/t5.py
+++ b/tutorial/python/t5.py
@@ -9,13 +9,10 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t5")
+gmsh.model.add("t5")
 
 lcar1 = .1
 lcar2 = .0005
@@ -46,90 +43,90 @@ lcar3 = .055
 
 # We proceed by defining some elementary entities describing a truncated cube:
 
-factory.addPoint(0.5,0.5,0.5, lcar2, 1)
-factory.addPoint(0.5,0.5,0, lcar1, 2)
-factory.addPoint(0,0.5,0.5, lcar1, 3)
-factory.addPoint(0,0,0.5, lcar1, 4)
-factory.addPoint(0.5,0,0.5, lcar1, 5)
-factory.addPoint(0.5,0,0, lcar1, 6)
-factory.addPoint(0,0.5,0, lcar1, 7)
-factory.addPoint(0,1,0, lcar1, 8)
-factory.addPoint(1,1,0, lcar1, 9)
-factory.addPoint(0,0,1, lcar1, 10)
-factory.addPoint(0,1,1, lcar1, 11)
-factory.addPoint(1,1,1, lcar1, 12)
-factory.addPoint(1,0,1, lcar1, 13)
-factory.addPoint(1,0,0, lcar1, 14)
-
-factory.addLine(8,9, 1);   factory.addLine(9,12, 2)
-factory.addLine(12,11, 3); factory.addLine(11,8, 4)
-factory.addLine(9,14, 5);  factory.addLine(14,13, 6)
-factory.addLine(13,12, 7); factory.addLine(11,10, 8)
-factory.addLine(10,13, 9); factory.addLine(10,4, 10)
-factory.addLine(4,5, 11);  factory.addLine(5,6, 12)
-factory.addLine(6,2, 13);  factory.addLine(2,1, 14)
-factory.addLine(1,3, 15);  factory.addLine(3,7, 16)
-factory.addLine(7,2, 17);  factory.addLine(3,4, 18)
-factory.addLine(5,1, 19);  factory.addLine(7,8, 20)
-factory.addLine(6,14, 21)
-
-factory.addCurveLoop([-11,-19,-15,-18], 22)
-factory.addPlaneSurface([22], 23)
-factory.addCurveLoop([16,17,14,15], 24)
-factory.addPlaneSurface([24], 25)
-factory.addCurveLoop([-17,20,1,5,-21,13], 26)
-factory.addPlaneSurface([26], 27)
-factory.addCurveLoop([-4,-1,-2,-3], 28)
-factory.addPlaneSurface([28], 29)
-factory.addCurveLoop([-7,2,-5,-6], 30)
-factory.addPlaneSurface([30], 31)
-factory.addCurveLoop([6,-9,10,11,12,21], 32)
-factory.addPlaneSurface([32], 33)
-factory.addCurveLoop([7,3,8,9], 34)
-factory.addPlaneSurface([34], 35)
-factory.addCurveLoop([-10,18,-16,-20,4,-8], 36)
-factory.addPlaneSurface([36], 37)
-factory.addCurveLoop([-14,-13,-12,19], 38)
-factory.addPlaneSurface([38], 39)
+gmsh.model.geo.addPoint(0.5,0.5,0.5, lcar2, 1)
+gmsh.model.geo.addPoint(0.5,0.5,0, lcar1, 2)
+gmsh.model.geo.addPoint(0,0.5,0.5, lcar1, 3)
+gmsh.model.geo.addPoint(0,0,0.5, lcar1, 4)
+gmsh.model.geo.addPoint(0.5,0,0.5, lcar1, 5)
+gmsh.model.geo.addPoint(0.5,0,0, lcar1, 6)
+gmsh.model.geo.addPoint(0,0.5,0, lcar1, 7)
+gmsh.model.geo.addPoint(0,1,0, lcar1, 8)
+gmsh.model.geo.addPoint(1,1,0, lcar1, 9)
+gmsh.model.geo.addPoint(0,0,1, lcar1, 10)
+gmsh.model.geo.addPoint(0,1,1, lcar1, 11)
+gmsh.model.geo.addPoint(1,1,1, lcar1, 12)
+gmsh.model.geo.addPoint(1,0,1, lcar1, 13)
+gmsh.model.geo.addPoint(1,0,0, lcar1, 14)
+
+gmsh.model.geo.addLine(8,9, 1);   gmsh.model.geo.addLine(9,12, 2)
+gmsh.model.geo.addLine(12,11, 3); gmsh.model.geo.addLine(11,8, 4)
+gmsh.model.geo.addLine(9,14, 5);  gmsh.model.geo.addLine(14,13, 6)
+gmsh.model.geo.addLine(13,12, 7); gmsh.model.geo.addLine(11,10, 8)
+gmsh.model.geo.addLine(10,13, 9); gmsh.model.geo.addLine(10,4, 10)
+gmsh.model.geo.addLine(4,5, 11);  gmsh.model.geo.addLine(5,6, 12)
+gmsh.model.geo.addLine(6,2, 13);  gmsh.model.geo.addLine(2,1, 14)
+gmsh.model.geo.addLine(1,3, 15);  gmsh.model.geo.addLine(3,7, 16)
+gmsh.model.geo.addLine(7,2, 17);  gmsh.model.geo.addLine(3,4, 18)
+gmsh.model.geo.addLine(5,1, 19);  gmsh.model.geo.addLine(7,8, 20)
+gmsh.model.geo.addLine(6,14, 21)
+
+gmsh.model.geo.addCurveLoop([-11,-19,-15,-18], 22)
+gmsh.model.geo.addPlaneSurface([22], 23)
+gmsh.model.geo.addCurveLoop([16,17,14,15], 24)
+gmsh.model.geo.addPlaneSurface([24], 25)
+gmsh.model.geo.addCurveLoop([-17,20,1,5,-21,13], 26)
+gmsh.model.geo.addPlaneSurface([26], 27)
+gmsh.model.geo.addCurveLoop([-4,-1,-2,-3], 28)
+gmsh.model.geo.addPlaneSurface([28], 29)
+gmsh.model.geo.addCurveLoop([-7,2,-5,-6], 30)
+gmsh.model.geo.addPlaneSurface([30], 31)
+gmsh.model.geo.addCurveLoop([6,-9,10,11,12,21], 32)
+gmsh.model.geo.addPlaneSurface([32], 33)
+gmsh.model.geo.addCurveLoop([7,3,8,9], 34)
+gmsh.model.geo.addPlaneSurface([34], 35)
+gmsh.model.geo.addCurveLoop([-10,18,-16,-20,4,-8], 36)
+gmsh.model.geo.addPlaneSurface([36], 37)
+gmsh.model.geo.addCurveLoop([-14,-13,-12,19], 38)
+gmsh.model.geo.addPlaneSurface([38], 39)
 
 shells = []
 
-sl = factory.addSurfaceLoop([35,31,29,37,33,23,39,25,27])
+sl = gmsh.model.geo.addSurfaceLoop([35,31,29,37,33,23,39,25,27])
 shells.append(sl)
 
 def cheeseHole(x, y, z, r, lc, shells):
     # This function will create a spherical hole in a volume. We don't specify
     # tags manually, and let the functions return them automatically:
 
-    p1 = factory.addPoint(x,  y,  z,   lc)
-    p2 = factory.addPoint(x+r,y,  z,   lc)
-    p3 = factory.addPoint(x,  y+r,z,   lc)
-    p4 = factory.addPoint(x,  y,  z+r, lc)
-    p5 = factory.addPoint(x-r,y,  z,   lc)
-    p6 = factory.addPoint(x,  y-r,z,   lc)
-    p7 = factory.addPoint(x,  y,  z-r, lc)
-
-    c1 = factory.addCircleArc(p2,p1,p7)
-    c2 = factory.addCircleArc(p7,p1,p5)
-    c3 = factory.addCircleArc(p5,p1,p4)
-    c4 = factory.addCircleArc(p4,p1,p2)
-    c5 = factory.addCircleArc(p2,p1,p3)
-    c6 = factory.addCircleArc(p3,p1,p5)
-    c7 = factory.addCircleArc(p5,p1,p6)
-    c8 = factory.addCircleArc(p6,p1,p2)
-    c9 = factory.addCircleArc(p7,p1,p3)
-    c10 = factory.addCircleArc(p3,p1,p4)
-    c11 = factory.addCircleArc(p4,p1,p6)
-    c12 = factory.addCircleArc(p6,p1,p7)
-
-    l1 = factory.addCurveLoop([c5,c10,c4])
-    l2 = factory.addCurveLoop([c9,-c5,c1])
-    l3 = factory.addCurveLoop([c12,-c8,-c1])
-    l4 = factory.addCurveLoop([c8,-c4,c11])
-    l5 = factory.addCurveLoop([-c10,c6,c3])
-    l6 = factory.addCurveLoop([-c11,-c3,c7])
-    l7 = factory.addCurveLoop([-c2,-c7,-c12])
-    l8 = factory.addCurveLoop([-c6,-c9,c2])
+    p1 = gmsh.model.geo.addPoint(x,  y,  z,   lc)
+    p2 = gmsh.model.geo.addPoint(x+r,y,  z,   lc)
+    p3 = gmsh.model.geo.addPoint(x,  y+r,z,   lc)
+    p4 = gmsh.model.geo.addPoint(x,  y,  z+r, lc)
+    p5 = gmsh.model.geo.addPoint(x-r,y,  z,   lc)
+    p6 = gmsh.model.geo.addPoint(x,  y-r,z,   lc)
+    p7 = gmsh.model.geo.addPoint(x,  y,  z-r, lc)
+
+    c1 = gmsh.model.geo.addCircleArc(p2,p1,p7)
+    c2 = gmsh.model.geo.addCircleArc(p7,p1,p5)
+    c3 = gmsh.model.geo.addCircleArc(p5,p1,p4)
+    c4 = gmsh.model.geo.addCircleArc(p4,p1,p2)
+    c5 = gmsh.model.geo.addCircleArc(p2,p1,p3)
+    c6 = gmsh.model.geo.addCircleArc(p3,p1,p5)
+    c7 = gmsh.model.geo.addCircleArc(p5,p1,p6)
+    c8 = gmsh.model.geo.addCircleArc(p6,p1,p2)
+    c9 = gmsh.model.geo.addCircleArc(p7,p1,p3)
+    c10 = gmsh.model.geo.addCircleArc(p3,p1,p4)
+    c11 = gmsh.model.geo.addCircleArc(p4,p1,p6)
+    c12 = gmsh.model.geo.addCircleArc(p6,p1,p7)
+
+    l1 = gmsh.model.geo.addCurveLoop([c5,c10,c4])
+    l2 = gmsh.model.geo.addCurveLoop([c9,-c5,c1])
+    l3 = gmsh.model.geo.addCurveLoop([c12,-c8,-c1])
+    l4 = gmsh.model.geo.addCurveLoop([c8,-c4,c11])
+    l5 = gmsh.model.geo.addCurveLoop([-c10,c6,c3])
+    l6 = gmsh.model.geo.addCurveLoop([-c11,-c3,c7])
+    l7 = gmsh.model.geo.addCurveLoop([-c2,-c7,-c12])
+    l8 = gmsh.model.geo.addCurveLoop([-c6,-c9,c2])
 
     # We need non-plane surfaces to define the spherical holes. Here we use the
     # `gmsh.model.geo.addSurfaceFilling()' function, which can be used for
@@ -143,17 +140,17 @@ def cheeseHole(x, y, z, r, lc, shells):
     # `gmsh.model.geo.addThruSections()' allows to create ruled surfaces (see
     # `t19.py').
 
-    s1 = factory.addSurfaceFilling([l1])
-    s2 = factory.addSurfaceFilling([l2])
-    s3 = factory.addSurfaceFilling([l3])
-    s4 = factory.addSurfaceFilling([l4])
-    s5 = factory.addSurfaceFilling([l5])
-    s6 = factory.addSurfaceFilling([l6])
-    s7 = factory.addSurfaceFilling([l7])
-    s8 = factory.addSurfaceFilling([l8])
-
-    sl = factory.addSurfaceLoop([s1, s2, s3, s4, s5, s6, s7, s8])
-    v = factory.addVolume([sl])
+    s1 = gmsh.model.geo.addSurfaceFilling([l1])
+    s2 = gmsh.model.geo.addSurfaceFilling([l2])
+    s3 = gmsh.model.geo.addSurfaceFilling([l3])
+    s4 = gmsh.model.geo.addSurfaceFilling([l4])
+    s5 = gmsh.model.geo.addSurfaceFilling([l5])
+    s6 = gmsh.model.geo.addSurfaceFilling([l6])
+    s7 = gmsh.model.geo.addSurfaceFilling([l7])
+    s8 = gmsh.model.geo.addSurfaceFilling([l8])
+
+    sl = gmsh.model.geo.addSurfaceLoop([s1, s2, s3, s4, s5, s6, s7, s8])
+    v = gmsh.model.geo.addVolume([sl])
     shells.append(sl)
     return v
 
@@ -163,12 +160,12 @@ for t in range(1, 6):
     x += 0.166
     z += 0.166
     v = cheeseHole(x, y, z, r, lcar3, shells)
-    model.addPhysicalGroup(3, [v], t)
+    gmsh.model.addPhysicalGroup(3, [v], t)
 
 # The volume of the cube, without the 5 holes, is defined by 6 surface loops:
 # the first surface loop defines the exterior surface; the surface loops other
 # than the first one define holes:
-factory.addVolume(shells, 186)
+gmsh.model.geo.addVolume(shells, 186)
 
 # Note that using solid modelling with the OpenCASCADE geometry kernel, the same
 # geometry could be built quite differently: see `t16.py'.
@@ -176,9 +173,9 @@ factory.addVolume(shells, 186)
 # We finally define a physical volume for the elements discretizing the cube,
 # without the holes (for which physical groups were already defined in the
 # `cheeseHole()' function):
-model.addPhysicalGroup(3, [186], 10)
+gmsh.model.addPhysicalGroup(3, [186], 10)
 
-factory.synchronize()
+gmsh.model.geo.synchronize()
 
 # We could make only part of the model visible to only mesh this subset:
 # ent = gmsh.model.getEntities()
@@ -205,7 +202,7 @@ gmsh.model.mesh.setAlgorithm(2, 33, 1)
 # gmsh.option.setNumber("Mesh.ElementOrder", 2)
 # gmsh.option.setNumber("Mesh.HighOrderOptimize", 2)
 
-model.mesh.generate(3)
+gmsh.model.mesh.generate(3)
 gmsh.write("t5.msh")
 
 # gmsh.fltk.run()
diff --git a/tutorial/python/t6.py b/tutorial/python/t6.py
index aea94af6d6651032c1327b8e8809659bd3041a30..c12de9f0a4e6d1554e34bad7a24563367ac1ddac 100644
--- a/tutorial/python/t6.py
+++ b/tutorial/python/t6.py
@@ -9,95 +9,94 @@
 import gmsh
 import math
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
-model.add("t6")
+gmsh.model.add("t6")
 
 # Copied from t1.py...
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
 
 # Delete the surface and the left line, and replace the line with 3 new ones:
-factory.remove([[2,1], [1,4]])
+gmsh.model.geo.remove([[2,1], [1,4]])
 
-p1 = factory.addPoint(-0.05, 0.05, 0, lc)
-p2 = factory.addPoint(-0.05, 0.1, 0, lc)
-l1 = factory.addLine(1, p1)
-l2 = factory.addLine(p1, p2)
-l3 = factory.addLine(p2, 4)
+p1 = gmsh.model.geo.addPoint(-0.05, 0.05, 0, lc)
+p2 = gmsh.model.geo.addPoint(-0.05, 0.1, 0, lc)
+l1 = gmsh.model.geo.addLine(1, p1)
+l2 = gmsh.model.geo.addLine(p1, p2)
+l3 = gmsh.model.geo.addLine(p2, 4)
 
 # Create surface
-factory.addCurveLoop([2, -1, l1, l2, l3, -3], 2)
-factory.addPlaneSurface([-2], 1)
+gmsh.model.geo.addCurveLoop([2, -1, l1, l2, l3, -3], 2)
+gmsh.model.geo.addPlaneSurface([-2], 1)
 
 # The `setTransfiniteCurve()' meshing constraints explicitly specifies the
 # location of the nodes on the curve. For example, the following command forces
 # 20 uniformly placed nodes on curve 2 (including the nodes on the two end
 # points):
-factory.mesh.setTransfiniteCurve(2, 20)
+gmsh.model.geo.mesh.setTransfiniteCurve(2, 20)
 
 # Let's put 20 points total on combination of curves `l1', `l2' and `l3' (beware
 # that the points `p1' and `p2' are shared by the curves, so we do not create 6
 # + 6 + 10 = 22 nodes, but 20!)
-factory.mesh.setTransfiniteCurve(l1, 6)
-factory.mesh.setTransfiniteCurve(l2, 6)
-factory.mesh.setTransfiniteCurve(l3, 10)
+gmsh.model.geo.mesh.setTransfiniteCurve(l1, 6)
+gmsh.model.geo.mesh.setTransfiniteCurve(l2, 6)
+gmsh.model.geo.mesh.setTransfiniteCurve(l3, 10)
 
 # Finally, we put 30 nodes following a geometric progression on curve 1
 # (reversed) and on curve 3: Put 30 points following a geometric progression
-factory.mesh.setTransfiniteCurve(1, 30, "Progression", -1.2)
-factory.mesh.setTransfiniteCurve(3, 30, "Progression", 1.2)
+gmsh.model.geo.mesh.setTransfiniteCurve(1, 30, "Progression", -1.2)
+gmsh.model.geo.mesh.setTransfiniteCurve(3, 30, "Progression", 1.2)
 
 # The `setTransfiniteSurface()' meshing constraint uses a transfinite
 # interpolation algorithm in the parametric plane of the surface to connect the
 # nodes on the boundary using a structured grid. If the surface has more than 4
 # corner points, the corners of the transfinite interpolation have to be
 # specified by hand:
-factory.mesh.setTransfiniteSurface(1, "Left", [1,2,3,4])
+gmsh.model.geo.mesh.setTransfiniteSurface(1, "Left", [1,2,3,4])
 
 # To create quadrangles instead of triangles, one can use the `setRecombine'
 # constraint:
-factory.mesh.setRecombine(2, 1)
+gmsh.model.geo.mesh.setRecombine(2, 1)
 
 # When the surface has only 3 or 4 points on its boundary the list of corners
 # can be omitted in the `setTransfiniteSurface()' call:
-factory.addPoint(0.2, 0.2, 0, 1.0, 7)
-factory.addPoint(0.2, 0.1, 0, 1.0, 8)
-factory.addPoint(0, 0.3, 0, 1.0, 9)
-factory.addPoint(0.25, 0.2, 0, 1.0, 10)
-factory.addPoint(0.3, 0.1, 0, 1.0, 11)
-factory.addLine(8, 11, 10)
-factory.addLine(11, 10, 11)
-factory.addLine(10, 7, 12)
-factory.addLine(7, 8, 13)
-factory.addCurveLoop([13, 10, 11, 12], 14)
-factory.addPlaneSurface([14], 15)
+gmsh.model.geo.addPoint(0.2, 0.2, 0, 1.0, 7)
+gmsh.model.geo.addPoint(0.2, 0.1, 0, 1.0, 8)
+gmsh.model.geo.addPoint(0, 0.3, 0, 1.0, 9)
+gmsh.model.geo.addPoint(0.25, 0.2, 0, 1.0, 10)
+gmsh.model.geo.addPoint(0.3, 0.1, 0, 1.0, 11)
+gmsh.model.geo.addLine(8, 11, 10)
+gmsh.model.geo.addLine(11, 10, 11)
+gmsh.model.geo.addLine(10, 7, 12)
+gmsh.model.geo.addLine(7, 8, 13)
+gmsh.model.geo.addCurveLoop([13, 10, 11, 12], 14)
+gmsh.model.geo.addPlaneSurface([14], 15)
 for i in range(10,14):
-    factory.mesh.setTransfiniteCurve(i, 10)
-factory.mesh.setTransfiniteSurface(15)
+    gmsh.model.geo.mesh.setTransfiniteCurve(i, 10)
+gmsh.model.geo.mesh.setTransfiniteSurface(15)
 
 # The way triangles are generated can be controlled by specifying "Left",
 # "Right" or "Alternate" in `setTransfiniteSurface()' command. Try e.g.
 #
-# factory.mesh.setTransfiniteSurface(15, "Alternate")
+# gmsh.model.geo.mesh.setTransfiniteSurface(15, "Alternate")
+
+gmsh.model.geo.synchronize()
 
 # Finally we apply an elliptic smoother to the grid to have a more regular
 # mesh:
 gmsh.option.setNumber("Mesh.Smoothing", 100)
 
-model.mesh.generate(2)
+gmsh.model.mesh.generate(2)
 gmsh.write("t6.msh")
 gmsh.finalize()
diff --git a/tutorial/python/t7.py b/tutorial/python/t7.py
index 2cf60d0c2a4149c7b66e31153aced971188a4e9c..9939441a151a29e467e5ceb1eb4fbf66aa2ac4bc 100644
--- a/tutorial/python/t7.py
+++ b/tutorial/python/t7.py
@@ -12,36 +12,33 @@ import os
 # Mesh sizes can be specified very accurately by providing a background mesh,
 # i.e., a post-processing view that contains the target characteristic lengths.
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
 # Create a simple rectangular geometry
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-
-factory.synchronize()
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+
+gmsh.model.geo.synchronize()
 
 # Merge a post-processing view containing the target mesh sizes
 path = os.path.dirname(os.path.abspath(__file__))
 gmsh.merge(os.path.join(path, '..', 't7_bgmesh.pos'))
 
 # Add the post-processing view as a new size field
-bg_field = model.mesh.field.add("PostView")
+bg_field = gmsh.model.mesh.field.add("PostView")
 
 # Apply the view as the current background mesh
-model.mesh.field.setAsBackgroundMesh(bg_field)
+gmsh.model.mesh.field.setAsBackgroundMesh(bg_field)
 
 # Background meshes are one particular case of general mesh size fields: see
 # `t10.py' for more mesh size field examples.
diff --git a/tutorial/python/t8.py b/tutorial/python/t8.py
index c0e689e5739f86aa25779575f02aa017bd2dc496..6bb74933c31307ab4b9072945129d9bb8ddf1765 100644
--- a/tutorial/python/t8.py
+++ b/tutorial/python/t8.py
@@ -12,26 +12,23 @@ import os
 # In addition to creating geometries and meshes, the Python API can also be used
 # to manipulate post-processing datasets (called "views" in Gmsh).
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
 # We first create a simple geometry
 lc = 1e-2
-factory.addPoint(0, 0, 0, lc, 1)
-factory.addPoint(.1, 0,  0, lc, 2)
-factory.addPoint(.1, .3, 0, lc, 3)
-factory.addPoint(0, .3, 0, lc, 4)
-factory.addLine(1, 2, 1)
-factory.addLine(3, 2, 2)
-factory.addLine(3, 4, 3)
-factory.addLine(4, 1, 4)
-factory.addCurveLoop([4, 1, -2, 3], 1)
-factory.addPlaneSurface([1], 1)
-
-factory.synchronize()
+gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
+gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
+gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
+gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
+gmsh.model.geo.addLine(1, 2, 1)
+gmsh.model.geo.addLine(3, 2, 2)
+gmsh.model.geo.addLine(3, 4, 3)
+gmsh.model.geo.addLine(4, 1, 4)
+gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
+gmsh.model.geo.addPlaneSurface([1], 1)
+
+gmsh.model.geo.synchronize()
 
 # We merge some post-processing views to work on
 path = os.path.dirname(os.path.abspath(__file__))
@@ -47,11 +44,10 @@ gmsh.merge(os.path.join(path, '..', 'view4.pos')) # contains 2 views inside
 # Python API.
 
 # We then set some general options:
-option = gmsh.option
-option.setNumber("General.Trackball", 0)
-option.setNumber("General.RotationX", 0)
-option.setNumber("General.RotationY", 0)
-option.setNumber("General.RotationZ", 0)
+gmsh.option.setNumber("General.Trackball", 0)
+gmsh.option.setNumber("General.RotationX", 0)
+gmsh.option.setNumber("General.RotationY", 0)
+gmsh.option.setNumber("General.RotationZ", 0)
 
 white = (255, 255, 255)
 black = (0, 0, 0)
@@ -59,15 +55,16 @@ black = (0, 0, 0)
 # Color options are special
 # Setting a color option of "X.Y" actually sets the option "X.Color.Y"
 # Sets "General.Color.Background", etc.
-option.setColor("General.Background", white[0], white[1], white[2])
+gmsh.option.setColor("General.Background", white[0], white[1], white[2])
 
 # We can make our own shorter versions of repetitive methods
-set_color = lambda name, c: option.setColor(name, c[0], c[1], c[2])
+set_color = lambda name, c: gmsh.option.setColor(name, c[0], c[1], c[2])
 set_color("General.Foreground", black)
 set_color("General.Text", black)
 
-option.setNumber("General.Orthographic", 0)
-option.setNumber("General.Axes", 0); option.setNumber("General.SmallAxes", 0)
+gmsh.option.setNumber("General.Orthographic", 0)
+gmsh.option.setNumber("General.Axes", 0);
+gmsh.option.setNumber("General.SmallAxes", 0)
 
 # Show the GUI
 gmsh.fltk.initialize()
@@ -87,10 +84,10 @@ def set_opt(name, val):
     # if it's a string, call the string method
     val_type = type(val)
     if val_type == type("str"):
-        option.setString(name, val)
+        gmsh.option.setString(name, val)
     # otherwise call the number method
     elif val_type == type(0.5) or val_type == type(1):
-        option.setNumber(name, val)
+        gmsh.option.setNumber(name, val)
     else:
         print("error: bad input to set_opt: " + name + " = " + str(val))
         print("error: set_opt is only meant for numbers and strings, aborting")
@@ -111,7 +108,7 @@ set_view_opt(v0, "SmoothNormals", 1)
 # v1
 set_view_opt(v1, "IntervalsType", 1)
 # We can't yet set the ColorTable in API
-# option.setColorTable(view_opt[v1] + "ColorTable", "{ Green, Blue }")
+# gmsh.option.setColorTable(view_opt[v1] + "ColorTable", "{ Green, Blue }")
 set_view_opt(v1, "NbIso", 10)
 set_view_opt(v1, "ShowScale", 0)
 
@@ -148,27 +145,30 @@ for num in range(1, 4):
         set_view_opt(v, "TimeStep", t)
 
     # helper function to match the geo file's +=, -= operators for numbers
-    adjust_num_opt = lambda name, diff: set_opt(name, option.getNumber(name) + diff)
+    adjust_num_opt =\
+    lambda name, diff: set_opt(name, gmsh.option.getNumber(name) + diff)
 
-    current_step = option.getNumber(view_fmt(v0) + "TimeStep")
-    max_step = option.getNumber(view_fmt(v0) + "NbTimeStep") - 1
+    current_step = gmsh.option.getNumber(view_fmt(v0) + "TimeStep")
+    max_step = gmsh.option.getNumber(view_fmt(v0) + "NbTimeStep") - 1
     if current_step < max_step:
         t = t + 1
     else:
         t = 0
 
-    v0_max = option.getNumber(view_fmt(v0) + "Max")
+    v0_max = gmsh.option.getNumber(view_fmt(v0) + "Max")
     adjust_num_opt(view_fmt(v0) + "RaiseZ", 0.01 / v0_max * t)
 
     if num == 3:
-        set_opt("General.GraphicsWidth", option.getNumber("General.MenuWidth") + 640)
+        set_opt("General.GraphicsWidth",
+                gmsh.option.getNumber("General.MenuWidth") + 640)
         set_opt("General.GraphicsHeight", 480)
 
     frames = 50
     for num2 in range(frames):
         # Incrementally rotate the scene
         adjust_num_opt("General.RotationX", 10)
-        set_opt("General.RotationY", option.getNumber("General.RotationX") / 3)
+        set_opt("General.RotationY",
+                gmsh.option.getNumber("General.RotationX") / 3)
         adjust_num_opt("General.RotationZ", 0.1)
 
         # Draw the scene
diff --git a/tutorial/python/t9.py b/tutorial/python/t9.py
index 7f2219f420314abe4a7210e02ccca2f26afa1838..2e33ae24c1ed531903f5fe59fc5d766925d0e826 100644
--- a/tutorial/python/t9.py
+++ b/tutorial/python/t9.py
@@ -18,9 +18,6 @@ import os
 # prefix, or from the graphical interface (right click on the view button, then
 # `Plugins').
 
-model = gmsh.model
-factory = model.geo
-
 gmsh.initialize()
 gmsh.option.setNumber("General.Terminal", 1)
 
@@ -30,46 +27,44 @@ gmsh.merge(os.path.join(path, '..', 'view3.pos'))
 
 # We then set some options for the `Isosurface' plugin (which extracts an
 # isosurface from a 3D scalar view), and run it:
-plugin = gmsh.plugin
-plugin.setNumber("Isosurface", "Value", 0.67)
-plugin.setNumber("Isosurface", "View", 0)
-plugin.run("Isosurface")
+gmsh.plugin.setNumber("Isosurface", "Value", 0.67)
+gmsh.plugin.setNumber("Isosurface", "View", 0)
+gmsh.plugin.run("Isosurface")
 
 # We also set some options for the `CutPlane' plugin (which computes a section
 # of a 3D view using the plane A*x+B*y+C*z+D=0), and then run it:
-plugin.setNumber("CutPlane", "A", 0)
-plugin.setNumber("CutPlane", "B", 0.2)
-plugin.setNumber("CutPlane", "C", 1)
-plugin.setNumber("CutPlane", "D", 0)
-plugin.setNumber("CutPlane", "View", 0)
-plugin.run("CutPlane")
+gmsh.plugin.setNumber("CutPlane", "A", 0)
+gmsh.plugin.setNumber("CutPlane", "B", 0.2)
+gmsh.plugin.setNumber("CutPlane", "C", 1)
+gmsh.plugin.setNumber("CutPlane", "D", 0)
+gmsh.plugin.setNumber("CutPlane", "View", 0)
+gmsh.plugin.run("CutPlane")
 
 # Add a title (By convention, for window coordinates a value greater than 99999
 # represents the center. We could also use `General.GraphicsWidth / 2', but that
 # would only center the string for the current window size.):
-plugin.setString("Annotate", "Text", "A nice title")
-plugin.setNumber("Annotate", "X", 1.e5)
-plugin.setNumber("Annotate", "Y", 50)
-plugin.setString("Annotate", "Font", "Times-BoldItalic")
-plugin.setNumber("Annotate", "FontSize", 28)
-plugin.setString("Annotate", "Align", "Center")
-plugin.setNumber("Annotate", "View", 0)
-plugin.run("Annotate")
+gmsh.plugin.setString("Annotate", "Text", "A nice title")
+gmsh.plugin.setNumber("Annotate", "X", 1.e5)
+gmsh.plugin.setNumber("Annotate", "Y", 50)
+gmsh.plugin.setString("Annotate", "Font", "Times-BoldItalic")
+gmsh.plugin.setNumber("Annotate", "FontSize", 28)
+gmsh.plugin.setString("Annotate", "Align", "Center")
+gmsh.plugin.setNumber("Annotate", "View", 0)
+gmsh.plugin.run("Annotate")
 
-plugin.setString("Annotate", "Text", "(and a small subtitle)")
-plugin.setNumber("Annotate", "Y", 70)
-plugin.setString("Annotate", "Font", "Times-Roman")
-plugin.setNumber("Annotate", "FontSize", 12)
-plugin.run("Annotate")
+gmsh.plugin.setString("Annotate", "Text", "(and a small subtitle)")
+gmsh.plugin.setNumber("Annotate", "Y", 70)
+gmsh.plugin.setString("Annotate", "Font", "Times-Roman")
+gmsh.plugin.setNumber("Annotate", "FontSize", 12)
+gmsh.plugin.run("Annotate")
 
 # We finish by setting some options:
-option = gmsh.option
-option.setNumber("View[0].Light", 1)
-option.setNumber("View[0].IntervalsType", 1)
-option.setNumber("View[0].NbIso", 6)
-option.setNumber("View[0].SmoothNormals", 1)
-option.setNumber("View[1].IntervalsType", 2)
-option.setNumber("View[2].IntervalsType", 2)
+gmsh.option.setNumber("View[0].Light", 1)
+gmsh.option.setNumber("View[0].IntervalsType", 1)
+gmsh.option.setNumber("View[0].NbIso", 6)
+gmsh.option.setNumber("View[0].SmoothNormals", 1)
+gmsh.option.setNumber("View[1].IntervalsType", 2)
+gmsh.option.setNumber("View[2].IntervalsType", 2)
 
 # show the GUI at the end
 gmsh.fltk.run()