Index: voting/pom.xml
===================================================================
--- voting/pom.xml	(revision 26)
+++ voting/pom.xml	(revision 27)
@@ -6,5 +6,5 @@
 	<groupId>geniusweb</groupId>
 	<artifactId>voting</artifactId>
-	<version>1.5.5</version> <!-- must equal ${geniusweb.version} -->
+	<version>1.5.6</version> <!-- must equal ${geniusweb.version} -->
 	<packaging>jar</packaging>
 
@@ -17,5 +17,5 @@
 		<passwd>${env.ARTIFACTORY_PASS}</passwd>
 		<jackson-2-version>2.9.10</jackson-2-version>
-		<geniusweb.version>1.5.5</geniusweb.version>
+		<geniusweb.version>1.5.6</geniusweb.version>
 	</properties>
 
Index: voting/src/main/java/geniusweb/voting/CollectedVotes.java
===================================================================
--- voting/src/main/java/geniusweb/voting/CollectedVotes.java	(revision 26)
+++ voting/src/main/java/geniusweb/voting/CollectedVotes.java	(revision 27)
@@ -85,10 +85,11 @@
 
 	/**
-	 * @return a hashmap containing the {@link Bid}s and a maximum-sized list of
-	 *         {@link PartyId}s that placed a satisfied vote for that bid.
-	 *         maximum-sized means that there is no larger subset of satisfied
-	 *         votes for that bid. There may be other subsets of equal size for
-	 *         the bid. If there are no agreements at all for a bid, the bid is
-	 *         not placed in the map.
+	 * @return a map containing for each {@link Bid}s a subset of
+	 *         {@link PartyId}s that placed a satisfied vote for that bid, such
+	 *         that the subset has maximum power. Maximum power means that there
+	 *         is no other subset of satisfied votes for that bid with more
+	 *         group power. There may be other subsets of equal power for the
+	 *         bid. If there are no concensus possibilities at all for a bid,
+	 *         the bid is not placed in the map.
 	 */
 	public Map<Bid, Set<PartyId>> getMaxAgreements() {
@@ -128,7 +129,16 @@
 	/**
 	 * 
+	 * @param parties a list of parties
+	 * @return total voting power of the parties
+	 */
+	public Integer getTotalPower(Set<PartyId> parties) {
+		return parties.stream().map(p -> powers.get(p)).reduce(0, Integer::sum);
+	}
+
+	/**
+	 * 
 	 * @param votes a list of all votes for a particular bid. The parties that
 	 *              placed the votes are called 'voters'
-	 * @return a consensusgroup with maximum power, so there is no other
+	 * @return a consensus-group with maximum power, so there is no other
 	 *         consensus group that has more power (but there may be other
 	 *         groups with same power).
@@ -150,11 +160,16 @@
 	/**
 	 * 
-	 * @param votes a set of {@link Votes} for one single {@link Bid}
-	 * @return all the consensus groups. A consensus group is a subset of the
-	 *         votes, for which the conditions holds (the combined power of
-	 *         these parties exceeds all voting conditions) if all these parties
-	 *         as a group are accepting that bid. This algorithm works in
-	 *         exponential space and the outcome may also be exponential in the
-	 *         input size.
+	 * @param votes a set of {@link Votes} for one single {@link Bid}. It is
+	 *              assumed all votes are by different parties.
+	 * @return all subsets sets of parties that create a viable consensus vote.
+	 *         A viable consensus voteset VS is a subset of the votes, such that
+	 *         <ol>
+	 *         <li>|VS| &ge; 2
+	 *         <li>TP = The sum of the powers of the parties in VS
+	 *         <li>forall v in VS: v_minpower &le; TP &le; v_maxpower
+	 *         </ol>
+	 *         Notice that this algorithm works in exponential space
+	 *         (=expensive) and not suited for large numbers of parties. Should
+	 *         work fine for up to 10 parties.
 	 */
 	protected Set<Set<PartyId>> getConsensusGroups(Set<Vote> votes) {
@@ -215,13 +230,4 @@
 		}
 		return min;
-	}
-
-	/**
-	 * 
-	 * @param parties a list of parties
-	 * @return total voting power of the parties
-	 */
-	private Integer getTotalPower(Set<PartyId> parties) {
-		return parties.stream().map(p -> powers.get(p)).reduce(0, Integer::sum);
 	}
 
Index: voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreement.java
===================================================================
--- voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreement.java	(revision 26)
+++ voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreement.java	(revision 27)
@@ -69,7 +69,7 @@
 			return agreement;// none
 
-		// find the best one
-		Bid maxbid = agrees.keySet().stream()
-				.max(Comparator.comparingInt(bid -> agrees.get(bid).size()))
+		// find the one with max group power
+		Bid maxbid = agrees.keySet().stream().max(Comparator
+				.comparingInt(bid -> allVotes.getTotalPower(agrees.get(bid))))
 				.get();
 		agreement = agreement.with(new Agreements(maxbid, agrees.get(maxbid)));
Index: voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreementsLoop.java
===================================================================
--- voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreementsLoop.java	(revision 26)
+++ voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreementsLoop.java	(revision 27)
@@ -77,7 +77,8 @@
 			if (agrees.isEmpty())
 				break;
-			// find the best one
+			// find the bid with max group power
 			Bid maxbid = agrees.keySet().stream()
-					.max(Comparator.comparingInt(bid -> agrees.get(bid).size()))
+					.max(Comparator.comparingInt(
+							bid -> allVotes.getTotalPower(agrees.get(bid))))
 					.get();
 			Set<PartyId> maxparties = agrees.get(maxbid);
Index: voting/src/test/java/geniusweb/voting/votingevaluators/LargestAgreementTest.java
===================================================================
--- voting/src/test/java/geniusweb/voting/votingevaluators/LargestAgreementTest.java	(revision 26)
+++ voting/src/test/java/geniusweb/voting/votingevaluators/LargestAgreementTest.java	(revision 27)
@@ -7,4 +7,5 @@
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 
@@ -15,5 +16,8 @@
 
 import geniusweb.actions.PartyId;
+import geniusweb.actions.Vote;
 import geniusweb.actions.Votes;
+import geniusweb.inform.Agreements;
+import geniusweb.issuevalue.Bid;
 import geniusweb.voting.CollectedVotes;
 import geniusweb.voting.VotingEvaluator;
@@ -26,4 +30,7 @@
 	private LargestAgreement lal1a = new LargestAgreement();
 	private PartyId party1 = new PartyId("party1");
+	private PartyId party2 = new PartyId("party2");
+	private PartyId party3 = new PartyId("party3");
+	private PartyId party4 = new PartyId("party4");
 	private Votes votes1 = mock(Votes.class);
 	private LargestAgreement lal2 = new LargestAgreement(
@@ -58,3 +65,37 @@
 	}
 
+	@Test
+	public void testCollectVotes() {
+		// we set up a tricky situation where party4 has much more power
+		// and therefore party 1+4 >> p1+2+3
+		Bid bid1 = mock(Bid.class);
+		Bid bid2 = mock(Bid.class);
+
+		CollectedVotes votes = new CollectedVotes(Collections.emptyMap(),
+				Collections.emptyMap());
+		votes = votes.with(new Votes(party1,
+				new HashSet<>(Arrays.asList(new Vote(party1, bid1, 1, 99),
+						new Vote(party1, bid2, 1, 99)))),
+				1);
+		votes = votes.with(
+				new Votes(party2,
+						new HashSet<>(
+								Arrays.asList(new Vote(party2, bid1, 1, 99)))),
+				1);
+		votes = votes.with(
+				new Votes(party3,
+						new HashSet<>(
+								Arrays.asList(new Vote(party3, bid1, 1, 99)))),
+				1);
+		votes = votes.with(
+				new Votes(party4,
+						new HashSet<>(
+								Arrays.asList(new Vote(party4, bid2, 1, 99)))),
+				4);
+		LargestAgreement la = new LargestAgreement(votes);
+		Agreements agreement = la.collectVotes();
+		assertEquals(new HashSet<PartyId>(Arrays.asList(party1, party4)),
+				agreement.getMap().keySet());
+	}
+
 }
