added new matrix functionality