Bringing mkmatrix up to code