diff --git a/gap/nofoma.gd b/gap/nofoma.gd
index bb6f6df..e978baa 100644
--- a/gap/nofoma.gd
+++ b/gap/nofoma.gd
@@ -375,7 +375,7 @@ DeclareGlobalFunction("JordanChevalleyDecMatF");
#! @Description
#! Returns a list containing three elements. The first element is
#! a base change matrix B such that BAB^{-1} is a
-#! primary form of A, i.e., a block diagonal matrix where the minimal polynomials
+#! primary form of the matrix A, i.e., a block diagonal matrix where the minimal polynomials
#! of the the diagonal blocks are precisely the powers of irreducible factors
#! of the minimal polynomial of A, in descending order. The second element is a list containing
#! the collected irreducible factors of the minimal polynomial of A, in the same order. The
@@ -399,7 +399,7 @@ DeclareGlobalFunction("JordanChevalleyDecMatF");
#! gap> MinimalPolynomial(PrimA{[2..5]}{[2..5]});
#! x_1^4-x_1^3+Z(5)^3*x_1+Z(5)^3
#! @EndExampleSession
-DeclareGlobalFunction("PrimaryDecomposition");
+DeclareAttribute("PrimaryDecomposition", IsMatrixOrMatrixObj);
#! @Chapter Auxiliary functions
#! @Section Vectors and matrices and their associated polynomials
diff --git a/gap/nofoma.gi b/gap/nofoma.gi
index 32b1e7e..0b0c037 100644
--- a/gap/nofoma.gi
+++ b/gap/nofoma.gi
@@ -759,7 +759,9 @@ end);
#Standalone version
#Returns matrix B such that B*A*B^-1 is in primary decomposition form
#along with dimensions of primary subspaces
-InstallGlobalFunction(PrimaryDecomposition, function(A)
+InstallMethod(PrimaryDecomposition,
+ [ IsMatrixOrMatrixObj ],
+function(A)
local rank,F,n,m,f,w,p,j,i,wspan,gens,facs,L_i,qi,k,v,
COB,pot,gs,f2,dims,toAdd,dim,minpol,collected;
rank := 0;