Cleaned up the matrix classes.