diff --git a/gext/main.py b/gext/main.py
index e09140c9e7846e18adacbbdeb7f8c162572f2a42..b9ce8c4bb4b211e6e94a0ae639a1e3820e4b6772 100644
--- a/gext/main.py
+++ b/gext/main.py
@@ -1,4 +1,4 @@
-"""Main module containing the Extrapolator class."""
+"""module containing the Extrapolator class."""
 
 from typing import Optional
 import numpy as np
@@ -21,6 +21,7 @@ class Extrapolator:
         "fitting": "diff",
         "allow_partially_filled": True,
         "store_overlap": True,
+        "tangent": "first",
     }
 
     def __init__(self, nelectrons: int, nbasis: int, natoms: int, **kwargs):
@@ -41,7 +42,9 @@ class Extrapolator:
         if self.options["store_overlap"]:
             self.overlaps = CircularBuffer(self.options["nsteps"],
                 (self.nbasis, self.nbasis))
-
+        if self.options["tangent"]=="one_before_last":
+            self.coeffs=CircularBuffer(self.options["nsteps"],
+                (self.nelectrons//2, self.nbasis))
         self.tangent: Optional[np.ndarray] = None
 
     def set_options(self, **kwargs):
@@ -101,12 +104,17 @@ class Extrapolator:
         coeff = self._normalize(coeff, overlap)
 
         # if it is the first time we load data, set the tangent point
-        if self.tangent is None:
+        if self.tangent is None and self.options["tangent"] is not "one_before_last":
             self._set_tangent(coeff)
 
         # push the new data to the corresponding vectors
-        self.gammas.push(self._grassmann_log(coeff))
+
         self.descriptors.push(self._compute_descriptor(coords))
+        if self.options["tangent"]=="one_before_last":
+            cropped_coeff = self._crop_coeff(coeff)
+            self.coeffs.push(cropped_coeff)
+        else:
+            self.gammas.push(self._grassmann_log(coeff))
 
         if self.options["store_overlap"]:
             self.overlaps.push(overlap)
@@ -141,9 +149,21 @@ class Extrapolator:
 
         # use the fitting coefficients and the previous gammas to
         # extrapolate a new gamma
-        gammas = self.gammas.get(n)
+
+        if self.options["tangent"]=="one_before_last":
+            coeffs=self.coeffs.get(n)
+
+            self._set_tangent(coeffs[-1])
+            gammas=[]
+            for i in range(len(coeffs)):
+                gammas.append(self._grassmann_log(coeffs[i]))
+            print('maxgamma_last', np.max(gammas[-1]))
+        else:
+            gammas = self.gammas.get(n)
+
+            print('maxgamm', np.max(gammas[0]))
         gamma = self.fitting_calculator.linear_combination(gammas, fit_coefficients)
-       
+
         if self.options["verbose"]:
             fit_descriptor = self.fitting_calculator.linear_combination(
                 prev_descriptors, fit_coefficients)
@@ -179,10 +199,13 @@ class Extrapolator:
 
     def _set_tangent(self, c: np.ndarray):
         """Set the tangent point."""
-        if self.tangent is None:
+        if self.options["tangent"]="one_before_last"
             self.tangent = c
         else:
-            raise ValueError("Resetting the tangent.")
+            if self.tangent is None:
+                self.tangent = c
+            else:
+                raise ValueError("Resetting the tangent.")
 
     def _grassmann_log(self, coeff: np.ndarray) -> np.ndarray:
         """Map from the manifold to the tangent plane."""