diff --git a/dev/src/dev.cpp b/dev/src/dev.cpp
index 9eba067713160ff2f7ddd9bae3edcd5dc2ccd793..3a07a91b02d98cc4244f9b5867b1f064ae894d9e 100644
--- a/dev/src/dev.cpp
+++ b/dev/src/dev.cpp
@@ -16,6 +16,14 @@ int main(int argc, char * argv[])
   for (int i = 0; i < 2; i++)
     configs.emplace_back(config);
 
+  configs[0].wordIndex = 2000;
+
+  configs[0].update();
+  configs[0].wordIndex = 0;
+
+  configs[0].update();
+  configs[0].update();
+  configs[0].update();
   configs[0].print(stdout);
 
   fmt::print(stderr, "ok\n");
diff --git a/reading_machine/include/Config.hpp b/reading_machine/include/Config.hpp
index c4f760739bee682a97cc199addbc962e7046ccd4..dae3e6cf43e61020f426b3c3ac21bbc7910070d1 100644
--- a/reading_machine/include/Config.hpp
+++ b/reading_machine/include/Config.hpp
@@ -25,6 +25,9 @@ class Config
   using ConstValueIterator = std::vector<String>::const_iterator;
 
   std::vector<String> lines;
+
+  public : 
+
   std::size_t wordIndex{0};
   std::size_t characterIndex{0};
   String state{"NONE"};
diff --git a/reading_machine/include/SubConfig.hpp b/reading_machine/include/SubConfig.hpp
index 18fd0d31d9a6ede7144c399f55dbc60f48d9461b..60faa69a2e296df860a9b545a25998af7e677bd9 100644
--- a/reading_machine/include/SubConfig.hpp
+++ b/reading_machine/include/SubConfig.hpp
@@ -13,7 +13,7 @@ class SubConfig : public Config
   private :
 
   const BaseConfig & model;
-  int firstLineIndex{0};
+  std::size_t firstLineIndex{0};
 
   private :
 
diff --git a/reading_machine/src/SubConfig.cpp b/reading_machine/src/SubConfig.cpp
index c93d145ab51c906252e6fd83b908fdbeebed4425..eeb284aec8cd390f681d000dbc2428e45625fc2a 100644
--- a/reading_machine/src/SubConfig.cpp
+++ b/reading_machine/src/SubConfig.cpp
@@ -2,6 +2,10 @@
 
 SubConfig::SubConfig(BaseConfig & model) : model(model)
 {
+  wordIndex = model.wordIndex;
+  characterIndex = model.characterIndex;
+  state = model.state;
+  history = model.history;
   update();
 }
 
@@ -12,36 +16,47 @@ bool SubConfig::update()
   if (currentLastLineIndex >= model.getNbLines()-1)
     return false;
 
-  unsigned int newFirstLineIndex = firstLineIndex + 0.8*(currentLastLineIndex-firstLineIndex);
-  unsigned int newLastLineIndex = std::min(newFirstLineIndex + spanSize, model.getNbLines());
+  std::size_t newFirstLineIndex = spanSize/2 >= wordIndex ? 0 : wordIndex - spanSize/2;
+  std::size_t newLastLineIndex = std::min(newFirstLineIndex + spanSize, model.getNbLines());
   unsigned int newLineNumber = newLastLineIndex - newFirstLineIndex;
 
   if (getNbLines() < newLineNumber)
     resizeLines(newLineNumber);
 
+  // The two windows are disjoint, we must copy every value from model
+  if (currentLastLineIndex <= newFirstLineIndex or newLastLineIndex <= firstLineIndex)
+  {
+    auto linesBegin = getIterator(0, firstLineIndex, 0);
+    auto firstToSave = model.getConstIterator(0, newFirstLineIndex, 0);
+    auto lastToSave = model.getConstIterator(0, newLastLineIndex, 0);
+
+    while (firstToSave != lastToSave)
+      *linesBegin++ = *firstToSave++;
+  } // The new window is a bit shifted to the write, we will keep the lasts elements from old window
+  else if (currentLastLineIndex > newFirstLineIndex and currentLastLineIndex < newLastLineIndex)
   {
     auto linesBegin = getIterator(0, firstLineIndex, 0);
     auto firstToSave = getConstIterator(0, newFirstLineIndex, 0);
     auto lastToSave = getConstIterator(0, currentLastLineIndex, 0);
 
     while (firstToSave != lastToSave)
-      (*linesBegin++) = (*firstToSave++);
-  }
+      *linesBegin++ = *firstToSave++;
 
-  if (getNbLines() > newLineNumber)
-    resizeLines(newLineNumber);
-
-  {
-    unsigned int nbLinesCopied = currentLastLineIndex - newFirstLineIndex;
-    auto newlinesBegin = getIterator(0, firstLineIndex+nbLinesCopied, 0);
-    auto firstToSave = model.getConstIterator(0, currentLastLineIndex, 0);
-    auto lastToSave = model.getConstIterator(0, newLastLineIndex, 0);
+    firstToSave = model.getConstIterator(0, currentLastLineIndex, 0);
+    lastToSave = model.getConstIterator(0, newLastLineIndex, 0);
 
     while (firstToSave != lastToSave)
-      (*newlinesBegin++) = (*firstToSave++);
-
-    firstLineIndex = newFirstLineIndex;
+      *linesBegin++ = *firstToSave++;
+  } // If the two windows are the same, do nothing.
+  else if (firstLineIndex == newFirstLineIndex and currentLastLineIndex == newLastLineIndex)
+  {
   }
+  else
+  {
+    util::myThrow("Update after a regression of wordIndex is not yet supported !");
+  }
+
+  firstLineIndex = newFirstLineIndex;
 
   return true;
 }