Added function to randomly fill matrix, improved submatrix functions