Implement class for better representation of matrix