Remove Mat struct and refactor tests