public static Input exileFromGraveType(final SpellAbility spell, final String type, final Cost_Payment payment) {
        Input target = new Input() {
            private static final long serialVersionUID = 734256837615635021L;

            @Override
            public void showMessage() {
                CardList typeList;
                int nNeeded = payment.getCost().getExileFromGraveAmount();
                typeList = AllZoneUtil.getPlayerGraveyard(spell.getSourceCard().getController());
                typeList = typeList.getValidCards(type.split(";"), spell.getActivatingPlayer(), spell.getSourceCard());

                for (int i = 0; i < nNeeded; i++) {
                    if (typeList.size() == 0)
                        cancel();

                    Object o = GuiUtils.getChoiceOptional("Exile from grave", typeList.toArray());

                    if (o != null) {
                        Card c = (Card) o;
                        typeList.remove(c);
                        payment.getAbility().addCostToHashList(c, "Exiled");
                        AllZone.getGameAction().exile(c);
                        if (i == nNeeded - 1) done();
                    }
                }
            }

            @Override
            public void selectButtonCancel() {
                cancel();
            }

            public void done() {
                payment.setPayExileFromGrave(true);
                stop();
                payment.payCost();
            }

            public void cancel() {
                payment.setCancel(true);
                stop();
                payment.payCost();
            }
        };
        return target;
    }//exileFromGraveType()