added matrix generator