public static Hand findDuplicateTypeHand(Set<Card> cardSet) { // quads, trips, pairs, or high cards
    	CardSetStats stats = new CardSetStats(cardSet);
    	// quads?
    	if (stats.quadsRank != null) {
    		List<Rank> remainingCards = stats.getRemainingHighCards(stats.quadsRank);
			return Hand.FourOfAKind(stats.quadsRank, remainingCards.get(0));
		}
    	// trips or full house?
    	if (stats.tripsList.size() > 0) {
    		Rank tripsRank = stats.tripsList.get(0);
    		if (stats.tripsList.size() > 1) {
    			// if there's another set of trips here, by definition there can't be other pairs.
    			Rank fhPair = stats.tripsList.get(1);
    			return Hand.FullHouse(tripsRank, fhPair);
    		} else {
    			// Look for pairs here 
    			if (stats.pairList.size() > 0) {
    				return Hand.FullHouse(tripsRank, stats.pairList.get(0));
    			} else {
    				List<Rank> remainingCards = stats.getRemainingHighCards(tripsRank);
    				return Hand.ThreeOfAKind(tripsRank, remainingCards.get(0), remainingCards.get(1));
    			}
    		}
    	}
    	// one or two pair?
    	if (stats.pairList.size() > 0) {
    		Rank highPairRank = stats.pairList.get(0);
    		if (stats.pairList.size() > 1) { // two pair
    			Rank secondPairRank = stats.pairList.get(1);
    			List<Rank> remainingCards = stats.getRemainingHighCards(stats.pairList.subList(0, 2));
    			return Hand.TwoPair(highPairRank, secondPairRank, remainingCards.get(0));
    		} else { // one pair
    			List<Rank> remainingCards = stats.getRemainingHighCards(highPairRank);
    			return Hand.OnePair(highPairRank, remainingCards.get(0), remainingCards.get(1), remainingCards.get(2));
    		}
    	}
    	// only high card hand possible
    	return Hand.HighCard(stats.rankList.get(0), stats.rankList.get(1), stats.rankList.get(2), stats.rankList.get(3), stats.rankList.get(4));
    }