Added a submatrix function