private Stack<Symbol> insertSymbolByPrecedence(Symbol symbol, Stack<Symbol> parseTree) {
        if (!parseTree.empty()) {
            // If last element was a number, then make that our left
            Symbol parent = parseTree.peek();
            Symbol child = parent.right;

            if (child != null) {
                // While there is a child of parent, keep going down the right side
                while (child != null && child.precedence() < symbol.precedence()) {
                    parent = child;
                    child = child.right;
                }
            }

            if (parent.precedence() < symbol.precedence()) {
                /* Symbol left will be the old child. New parent child will be the Symbol. To allow infinite negations,
                 * we have to check for unary operator */
                if (symbol.left == null) {
                    symbol.left = child;
                }

                parent.right = symbol;
            }
            else {
                /* This can be one of two things, either we are the same precedence or we are less precedence than the
                 * parent. This also means different things for unary ops. The most recent unary op (negate) has a
                 * higher precedence */
                UnaryOperator operator = new Negate();

                if (symbol.getClass() == operator.getClass()) {
                    while (child != null && child.precedence() == symbol.precedence()) {
                        parent.right = symbol;
                        child = child.right;
                    }
                }
                else {
                    /* Everything else is evaluated the same. For instance, if this is 5 * 4 / 2, and we currently have
                     * Multi(5, 4) in the parseTree, we need to make parent our left child */
                    symbol.left = parent;
                    parseTree.pop();
                    parseTree.push(symbol);
                    parent = child;
                }
            }
        }
        else {
            parseTree.push(symbol);
        }

        return parseTree;
    }