diff --git a/polynomial.py b/polynomial.py
index 85f8d61c6215340a7ca35424963ca1977cc7f526..6ea1a7d6ca6c9cd90ca38f6baccaad5549c7175a 100644
--- a/polynomial.py
+++ b/polynomial.py
@@ -124,10 +124,9 @@ def compute_bachet_bezout(a, b):
 
 
 def modular_inverse(a, n):
-    bachet_bezout = compute_bachet_bezout(a,n)
-    modular_inverse = bachet_bezout[0]
-    if a * modular_inverse % n == 1:
-        return modular_inverse
+    coefficients = compute_bachet_bezout(a, n)
+    if a * coefficients[0] % n == 1:
+        return coefficients[0] % n
     return None