public static Input exileType(final SpellAbility sa, final String type, final Cost_Payment payment) {
        Input target = new Input() {
            private static final long serialVersionUID = 1403915758082824694L;

            private CardList typeList;
            private int nExiles = 0;
            private int nNeeded = payment.getCost().getExileAmount();

            @Override
            public void showMessage() {
                StringBuilder msg = new StringBuilder("Exile ");
                int nLeft = nNeeded - nExiles;
                msg.append(nLeft).append(" ");
                msg.append(type);
                if (nLeft > 1) {
                    msg.append("s");
                }

                typeList = AllZoneUtil.getPlayerCardsInPlay(sa.getSourceCard().getController());
                typeList = typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
                AllZone.getDisplay().showMessage(msg.toString());
                ButtonUtil.enableOnlyCancel();
            }

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

            @Override
            public void selectCard(Card card, PlayerZone zone) {
                if (typeList.contains(card)) {
                    nExiles++;
                    payment.getAbility().addCostToHashList(card, "Exiled");
                    AllZone.getGameAction().exile(card);
                    typeList.remove(card);
                    //in case nothing else to exile
                    if (nExiles == nNeeded)
                        done();
                    else if (typeList.size() == 0)    // this really shouldn't happen
                        cancel();
                    else
                        showMessage();
                }
            }

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

            public void cancel() {
                payment.setCancel(true);
                stop();
                payment.payCost();
            }
        };

        return target;
    }//exileType()