More mat.py changes