Added exceptions and more consistent comments (parts of Mat)