Tidy up matrix classes (linking).