updated matrix.pl