changed matrix operations