Matrix generics - all done plus some fixes