changed Matrix to use typedefs