diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -43,3 +43,7 @@
 ## 0.5.0.0 -- 2021-06-28
 
 * Fifth version. Added a new module Data.SubG.Unfold inspired by: https://www.works-hub.com/learn/number-anamorphisms-aka-unfolds-explained-50e1a by Marty Stumpf.
+
+## 0.5.1.0 -- 2021-06-28
+
+* Fifth version revised A. Changed the code for Data.SubG.Unfold.unfoldG function influenced more by the Data.List.unfoldr code.
diff --git a/Data/SubG/Unfold.hs b/Data/SubG/Unfold.hs
--- a/Data/SubG/Unfold.hs
+++ b/Data/SubG/Unfold.hs
@@ -14,7 +14,6 @@
 ) where
 
 import Data.SubG
-import Data.Maybe (isJust, fromJust)
 import Data.Monoid
 
 -- | Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words
@@ -23,9 +22,10 @@
 -- Also inspired by: https://www.works-hub.com/learn/number-anamorphisms-aka-unfolds-explained-50e1a by Marty Stumpf.
 -- Generalizes the 'Data.List.unfoldr' function not only for lists, but for the data type that has 'InsertLeft' and 'Monoid' instances.
 unfoldG :: (InsertLeft t a, Monoid (t a)) => (a -> Maybe (a, a)) -> a -> t a
-unfoldG p x
- | isJust (p x) = x %@ unfoldG p (snd . fromJust . p $ x)
- | otherwise = mempty
+unfoldG p x =
+ case p x of
+   Just (y, z) -> x %@ unfoldG p z
+   Nothing -> mempty
 
 -- | Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words
 -- and: Graham Hutton. A tutorial on the universality and expressiveness of fold. /J. Functional Programming/ 9 (4): 355–372, July 1999.
diff --git a/subG.cabal b/subG.cabal
--- a/subG.cabal
+++ b/subG.cabal
@@ -2,7 +2,7 @@
 -- see http://haskell.org/cabal/users-guide/
 
 name:                subG
-version:             0.5.0.0
+version:             0.5.1.0
 synopsis:            Some extension to the Foldable and Monoid classes.
 description:         Introduces a new class InsertLeft -- the class of types of values that can be inserted from the left to the Foldable structure that is a data that is also the Monoid instance. Also contains some functions to find out both minimum and maximum elements of the finite Foldable structures.
 homepage:            https://hackage.haskell.org/package/subG
