public static void simplifySolve(Node node)			//simplifies all solvable child nodes
    {
        if(node.child.size() == 0)				//leaf nodes would be values, so no simplification needed
        {
            return;
        }
        else if(node.child.size() == 1 && !node.data.equals("-") && node.data.charAt(0) != '&')		//remove redundancies like +(y)  except when like -(y)
        {
            node.data = node.child.get(0).data;
            node.child = node.child.get(0).child;
        }

        double t;

        try
        {
            t = solve(node);	//try solving
        }
        catch(NumberFormatException e)				//if not solvable
        {
            for (Node aChild : node.child) {
                simplifySolve(aChild);        //recursion
                solveFlexible(aChild);
            }
            solveFlexible(node);
            return;
        }

        node.data = String.valueOf(t);				//if solvable, replace data with value
        node.child.clear();							//empty child array
    }