private Stack<Symbol> handleParentheses(String inputExpression, int index, Stack<Symbol> masterParseTree,
                                            String parseTreeType) {
        accumulatedPrecedence += Symbol.parenPrecedence;
        Stack<Symbol> localParseTree = new Stack<>();

        // Process the input expression between the parentheses.
        for (++index; index < inputExpression.length(); ++index) {
            localParseTree = parseTreeType.equals("algebraic") ?
                    parseNextAlgebraicSymbol(inputExpression, index, localParseTree) :
                    parseNextBooleanSymbol(inputExpression, index, localParseTree);

            if (multiDigitNumbers > index) {
                index = multiDigitNumbers;
            }

            // Reduce the accumulated precedence and break from loop once we leave the parentheses
            if (inputExpression.charAt(index) == ')') {
                accumulatedPrecedence -= Symbol.parenPrecedence;
                break;
            }
        }

        if (masterParseTree.size() > 0 && localParseTree.size() > 0) {
            masterParseTree = insertSymbolByPrecedence(localParseTree.peek(), masterParseTree);
        }
        else if (localParseTree.size() > 0) {
            masterParseTree = localParseTree;
        }

        return masterParseTree;
    }