Final fixes to mat class