added matrix class