updated lab3-mat