cleaned up MatType implementation