added some matrix stuff, incomplete