API: clean Mat API, updated tests