refactoring to matrix