Matrix refactored.