Added a function to reduce the matrix