Added matrix typeclass
cleaning up