changed matrix type to use enum