separated matrix testing jazz into a different function. added full leak checking to make valgrind.