Added matrix operations code