matrix additional tests, vector tests, refactor