Added some matrix functions