Matrix debug, added a test class for developing/debugging matrix.
lots of changes