Updated matrix constructor