improve matrix