Created generate from matrix method for easy mocking