private static void internalGetArgPositionsForTerm(Object term, Object subTree,
          final ArgPosition curPosPath, final List<ArgPosition> result) {
    if (term instanceof CycNart) {
      term = ((CycNart) term).toCycList();
    }
    if (term == subTree) {
      final ArgPosition newArgPos = new ArgPosition(curPosPath.getPath());
      result.add(newArgPos);
      return;
    }
    if (subTree == null) {
      return;
    }
    if (subTree instanceof CycNart) {
      subTree = ((CycNart) subTree).toCycList();
    }
    if (subTree.equals(term)) {
      final ArgPosition newArgPos = new ArgPosition(curPosPath.getPath());
      result.add(newArgPos);
      return;
    }
    if ((subTree instanceof CycList) && ((CycList) subTree).treeContains(term)) {
      int newPos = 0;
      for (Iterator iter = ((List) subTree).iterator(); iter.hasNext(); newPos++) {
        final ArgPosition newPosPath = new ArgPosition(curPosPath.getPath());
        newPosPath.extend(newPos);
        internalGetArgPositionsForTerm(term, iter.next(), newPosPath, result);
      }
    }
  }