moved toTable to Matrix