diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,3 +47,7 @@
 ## 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.
+
+## 0.5.2.0 -- 2021-06-28
+
+* Fifth version revised A. Changed the code for Data.SubG.Unfold.unfoldG to be more general.
diff --git a/Data/SubG/Unfold.hs b/Data/SubG/Unfold.hs
--- a/Data/SubG/Unfold.hs
+++ b/Data/SubG/Unfold.hs
@@ -21,10 +21,10 @@
 -- that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf.
 -- 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 :: (InsertLeft t a, Monoid (t a)) => (b -> Maybe (a, b)) -> b -> t a
 unfoldG p x =
  case p x of
-   Just (y, z) -> x %@ unfoldG p z
+   Just (y, z) -> y %@ unfoldG p z
    Nothing -> mempty
 
 -- | Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2020 OleksandrZhabenko
+Copyright (c) 2020-2021 OleksandrZhabenko
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
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.1.0
+version:             0.5.2.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
