updated with function in displaying the matrix