added the matrix gen