Restored matrix_def order but keep functionality.