Improve matrix helpers