code: private String chopBranch(String remainder) {
          boolean doChop = false;
          int branchLevel = 0;
          StringBuffer choppedString = new StringBuffer();
          for (int i = 0; i < remainder.length(); i++) {
              char currentChar = remainder.charAt(i);
              if (currentChar == '(') {
                  if (doChop) choppedString.append(currentChar);
                  doChop = true;
                  branchLevel++;
              } else if (currentChar == ')') {
                  branchLevel--;
                  if (branchLevel == 0) {
                      doChop = false;
                      break;
                  }
                  if (doChop) choppedString.append(currentChar);
              } else if (doChop) {
                  choppedString.append(currentChar);
              }
          }
          return choppedString.toString();
      }
docs: Extracts the first full branch. It extracts everything between the first
  '(' and the corresponding ')' char.