Changed martix representation to a maximum of 10 columns and rows and changed pmatrix to array