public static Cons extractOptions(Cons tree, KeyValueList optionstable) {
    { Cons options = null;
      Cons tail = null;

      while ((!(tree.rest == Stella.NIL)) &&
          (!Stella_Object.keywordP(tree.rest.value))) {
        tree = tree.rest;
      }
      if ((tree.rest == Stella.NIL) ||
          (tree.rest.rest == Stella.NIL)) {
        return (Stella.NIL);
      }
      if (optionstable != null) {
        optionstable.insertAt(tree.rest.value, tree.rest.rest.value);
      }
      options = tree.rest;
      tail = tree.rest.rest;
      while ((!(tail.rest.rest == Stella.NIL)) &&
          Stella_Object.keywordP(tail.rest.value)) {
        if (optionstable != null) {
          optionstable.insertAt(tail.rest.value, tail.rest.rest.value);
        }
        tail = tail.rest.rest;
      }
      tree.rest = tail.rest;
      tail.rest = Stella.NIL;
      return (options);
    }
  }