refactoring of 'TestMatrix'