unit tests segmented out; small matrix cleanup