public int visitNode(TreeNode node){
        int left = 0, right = 0;
        if(node.left != null) left = visitNode(node.left);
        if(node.right != null) right = visitNode(node.right);
        if(node.val + left + right > max) max = node.val + left + right;
        if(node.val > maxNode) maxNode = node.val; 
        
        int toReturn = getMax(left, right);
        toReturn = getMax(node.val, toReturn + node.val);
        return getMax(toReturn, 0);
    }