restructure test again, finish matrix implementation