working on submatrix creator