typos
change to handle matrices of different sizes