public static Cons helpCollectForwardRules(Description description, KeyValueList rules, KeyValueList indices, boolean toucheddefaultP, List beenthere) {
    if (rules == null) {
      rules = KeyValueList.newKeyValueList();
    }
    if (indices == null) {
      indices = KeyValueList.newKeyValueList();
    }
    if (beenthere == null) {
      beenthere = List.newList();
    }
    beenthere.insert(description);
    { ForwardChainingIndex index = null;
      Cons iter000 = description.forwardChainingIndices().theConsList;

      for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
        index = ((ForwardChainingIndex)(iter000.value));
        if ((!index.masterRule.deletedP()) &&
            Proposition.trueP(index.masterRule)) {
          indices.insertAt(index, (toucheddefaultP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER));
        }
      }
    }
    { Proposition p = null;
      Cons iter001 = LogicObject.applicableRulesOfDescription(description, Logic.KWD_FORWARD, true);

      for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
        p = ((Proposition)(iter001.value));
        if (!((BooleanWrapper)(KeyValueList.dynamicSlotValue(p.dynamicSlots, Logic.SYM_LOGIC_BACKWARD_ONLYp, Stella.FALSE_WRAPPER))).wrapperValue) {
          { Stella_Object consequent = (p.arguments.theArray)[1];

            { Surrogate testValue000 = Stella_Object.safePrimaryType(consequent);

              if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
                { NamedDescription consequent000 = ((NamedDescription)(consequent));

                  { Stella_Object renamed_Super = Logic.valueOf(consequent000);

                    if (Proposition.defaultTrueP(p)) {
                      toucheddefaultP = true;
                    }
                    if (((BooleanWrapper)(KeyValueList.dynamicSlotValue(p.dynamicSlots, Logic.SYM_LOGIC_FORWARD_ONLYp, Stella.FALSE_WRAPPER))).wrapperValue ||
                        (!(Logic.classP(description) == Logic.classP(renamed_Super)))) {
                      rules.insertAt(p, (toucheddefaultP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER));
                    }
                    if (!beenthere.memberP(renamed_Super)) {
                      Description.helpCollectForwardRules(((Description)(renamed_Super)), rules, indices, toucheddefaultP, beenthere);
                    }
                  }
                }
              }
              else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_DESCRIPTION)) {
                { Description consequent000 = ((Description)(consequent));

                  rules.insertAt(p, (toucheddefaultP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER));
                }
              }
              else {
              }
            }
          }
        }
      }
    }
    return (Cons.cons(rules, Cons.cons(indices, Stella.NIL)));
  }