Index: protocol/src/main/java/geniusweb/protocol/session/SessionResult.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/SessionResult.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/SessionResult.java	(revision 23)
@@ -2,5 +2,5 @@
 
 import java.util.Collections;
-import java.util.List;
+import java.util.Map;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
@@ -10,4 +10,5 @@
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
 
+import geniusweb.actions.PartyId;
 import geniusweb.inform.Agreements;
 import geniusweb.references.PartyWithProfile;
@@ -19,7 +20,7 @@
 @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
 public class SessionResult {
-	private final List<PartyWithProfile> participants;
+	private final Map<PartyId, PartyWithProfile> participants;
 	private final Agreements agreements;
-	private final List<Double> penalties;
+	private final Map<PartyId, Double> penalties;
 
 	// add more type info so that jackson can deserialize the actual class
@@ -29,11 +30,9 @@
 	/**
 	 * 
-	 * @param participants the list oof {@link PartyWithProfile}, in the proper
-	 *                     order (this is relevant for the protocol etc). Should
-	 *                     never be null. Some of them may have entered later of
-	 *                     left early. This list should contain them all.
+	 * @param participants the list oof {@link PartyWithProfile}. Should never
+	 *                     be null. Some of them may have entered later of left
+	 *                     early. This list should contain them all.
 	 * @param agreements   the final Agreements.
-	 * @param penalties    the penalties in [0,1] for each participant, same
-	 *                     order as the participants list.
+	 * @param penalties    the penalties in [0,1] for each participant.
 	 * @param error        a fatal error that terminated the session. Non-fatal
 	 *                     errors (warnings) are not to be reported. Null if no
@@ -46,7 +45,7 @@
 	@JsonCreator
 	public SessionResult(
-			@JsonProperty("participants") List<PartyWithProfile> participants,
+			@JsonProperty("participants") Map<PartyId, PartyWithProfile> participants,
 			@JsonProperty("agreements") Agreements agreements,
-			@JsonProperty("penalties") List<Double> penalties,
+			@JsonProperty("penalties") Map<PartyId, Double> penalties,
 			@JsonProperty("error") Throwable error) {
 		this.participants = participants;
@@ -58,11 +57,11 @@
 	/**
 	 * 
-	 * @return the list oof {@link PartyWithProfile}, in the proper order (this
-	 *         is relevant for the protocol etc). Should never be null. Some of
-	 *         them may have entered later of left early. This list should
-	 *         contain them all.
+	 * @return the map with for each {@link PartyId} the
+	 *         {@link PartyWithProfile}. Should never be null. Some of them may
+	 *         have entered later of left early. This list should contain them
+	 *         all.
 	 */
-	public List<PartyWithProfile> getParticipants() {
-		return Collections.unmodifiableList(participants);
+	public Map<PartyId, PartyWithProfile> getParticipants() {
+		return Collections.unmodifiableMap(participants);
 	}
 
@@ -77,8 +76,8 @@
 	/**
 	 * 
-	 * @return list of penalties, in same order as {@link #getParticipants()}.
+	 * @return Map of penalties,
 	 */
-	public List<Double> getPenalties() {
-		return Collections.unmodifiableList(penalties);
+	public Map<PartyId, Double> getPenalties() {
+		return Collections.unmodifiableMap(penalties);
 	}
 
Index: protocol/src/main/java/geniusweb/protocol/session/amop/AMOPState.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/amop/AMOPState.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/amop/AMOPState.java	(revision 23)
@@ -255,9 +255,6 @@
 	@Override
 	public SessionResult getResult() {
-		List<Double> emptylist = new LinkedList<>();
-		for (int n = 0; n < getConnections().size(); n++)
-			emptylist.add(0d);
-		return new SessionResult(getSettings().getAllParties(), getAgreements(),
-				emptylist, null);
+		return new SessionResult(partyprofiles, getAgreements(),
+				Collections.emptyMap(), null);
 	}
 
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/MOPAC.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/MOPAC.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/MOPAC.java	(revision 23)
@@ -145,5 +145,5 @@
 			ProtocolToPartyConnFactory connectionfactory) {
 		try {
-			//System.out.println("starting MOPAC");
+			// System.out.println("starting MOPAC");
 			// we're in Phase.INIT still
 			connect(connectionfactory);
@@ -314,5 +314,6 @@
 			final ProtocolToPartyConn partyconn, final Action action,
 			long now) {
-		//System.out.println("received " + action);
+		if (finished)
+			return;
 		state = state.with(partyconn.getParty(), action, now);
 		checkEndPhase(System.currentTimeMillis());
@@ -352,5 +353,5 @@
 	 */
 	private void broadcastNegotiators(Inform info) {
-		//System.out.println("broadcasting " + info);
+		// System.out.println("broadcasting " + info);
 		for (PartyId party : state.getPhase().getPartyStates()
 				.getNegotiatingParties()) {
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/MOPACState.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/MOPACState.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/MOPACState.java	(revision 23)
@@ -270,9 +270,6 @@
 	@Override
 	public SessionResult getResult() {
-		List<Double> emptylist = new LinkedList<>();
-		for (int n = 0; n < getConnections().size(); n++)
-			emptylist.add(0d);
-		return new SessionResult(getSettings().getAllParties(), getAgreements(),
-				emptylist, null);
+		return new SessionResult(partyprofiles, getAgreements(),
+				Collections.emptyMap(), null);
 	}
 
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/phase/DefaultPhase.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/phase/DefaultPhase.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/phase/DefaultPhase.java	(revision 23)
@@ -3,4 +3,6 @@
 import java.util.List;
 import java.util.stream.Collectors;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
 
 import geniusweb.actions.Action;
@@ -12,22 +14,26 @@
 
 public abstract class DefaultPhase implements Phase {
-	protected final List<Class<? extends Action>> allowedActions;
-	protected final Long deadline; // unix timestamp ms since 1970
+	// deadline for this phase, ms since 1970
+	protected final Long deadline;
+	protected final PartyStates partyStates;
+
+	// don't serialize this, users don't need it..
+	@JsonIgnore
+	protected final VotingEvaluator evaluator;
+
+	// don't serialize this, it will cause very large file
+	@JsonIgnore
 	protected final Phase prevPhase;
-	protected final PartyStates partyStates;
-	protected final VotingEvaluator evaluator;
 
 	/**
 	 * 
-	 * @param actions
-	 * @param prevPhases
+	 * @param actions     the actions done in this phase .
+	 * @param prevPhase   the previous phase, can be used to collect previous
+	 *                    votes etc.
 	 * @param partyStates
-	 * @param allowed
-	 * @param deadline    deadline time ms since 1970
+	 * @param deadline    deadline for this phase, ms since 1970
 	 */
-	public DefaultPhase(Phase prevPhase, PartyStates partyStates,
-			List<Class<? extends Action>> allowed, Long deadline,
+	public DefaultPhase(Phase prevPhase, PartyStates partyStates, Long deadline,
 			VotingEvaluator evaluator) {
-		this.allowedActions = allowed;
 		this.partyStates = partyStates;
 		this.deadline = deadline;
@@ -82,5 +88,5 @@
 		if (isFinal(timems))
 			throw new ProtocolException("passed deadline", actor);
-		if (!(allowedActions.contains(action.getClass())))
+		if (!(getAllowedActions().contains(action.getClass())))
 			throw new ProtocolException(
 					"Action not allowed in " + this.getClass() + ":" + action,
@@ -129,5 +135,5 @@
 		// contains prevstate.....
 		return getClass().getSimpleName() + "[" + partyStates + "," + deadline
-				+ "," + allowedActions + "," + evaluator + "]";
+				+ "," + evaluator + "]";
 	}
 }
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OfferPhase.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OfferPhase.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OfferPhase.java	(revision 23)
@@ -20,7 +20,5 @@
 	public OfferPhase(Phase prevPhase, PartyStates partyStates, Long deadlinems,
 			VotingEvaluator evaluator) {
-		super(prevPhase, partyStates,
-				Arrays.asList(Offer.class, EndNegotiation.class), deadlinems,
-				evaluator);
+		super(prevPhase, partyStates, deadlinems, evaluator);
 	}
 
@@ -64,3 +62,8 @@
 	}
 
+	@Override
+	public List<Class<? extends Action>> getAllowedActions() {
+		return Arrays.asList(Offer.class, EndNegotiation.class);
+	}
+
 }
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OptInPhase.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OptInPhase.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OptInPhase.java	(revision 23)
@@ -2,4 +2,5 @@
 
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -21,7 +22,5 @@
 	protected OptInPhase(Phase prevPhase, PartyStates partyStates,
 			Long deadlinems, VotingEvaluator evaluator) {
-		super(prevPhase, partyStates,
-				Arrays.asList(Votes.class, EndNegotiation.class), deadlinems,
-				evaluator);
+		super(prevPhase, partyStates, deadlinems, evaluator);
 	}
 
@@ -94,3 +93,8 @@
 	}
 
+	@Override
+	public List<Class<? extends Action>> getAllowedActions() {
+		return Arrays.asList(Votes.class, EndNegotiation.class);
+	}
+
 }
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/phase/Phase.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/phase/Phase.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/phase/Phase.java	(revision 23)
@@ -1,5 +1,9 @@
 package geniusweb.protocol.session.mopac.phase;
 
+import java.util.List;
 import java.util.Set;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
 
 import geniusweb.actions.Action;
@@ -15,4 +19,5 @@
  *
  */
+@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
 public interface Phase {
 	public static final Long PHASE_MAXTIME = 30000l; // 30sec
@@ -99,3 +104,8 @@
 	public PartyStates getPartyStates();
 
+	/**
+	 * @return the allowed actinos in this phase
+	 */
+	public abstract List<Class<? extends Action>> getAllowedActions();
+
 }
Index: protocol/src/main/java/geniusweb/protocol/session/mopac/phase/VotingPhase.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/mopac/phase/VotingPhase.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/mopac/phase/VotingPhase.java	(revision 23)
@@ -2,4 +2,5 @@
 
 import java.util.Arrays;
+import java.util.List;
 
 import geniusweb.actions.Action;
@@ -17,7 +18,5 @@
 	VotingPhase(Phase prevPhase, PartyStates partyStates, Long deadlinems,
 			VotingEvaluator evaluator) {
-		super(prevPhase, partyStates,
-				Arrays.asList(Votes.class, EndNegotiation.class), deadlinems,
-				evaluator);
+		super(prevPhase, partyStates, deadlinems, evaluator);
 	}
 
@@ -56,3 +55,8 @@
 	}
 
+	@Override
+	public List<Class<? extends Action>> getAllowedActions() {
+		return Arrays.asList(Votes.class, EndNegotiation.class);
+	}
+
 }
Index: protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java	(revision 23)
@@ -266,9 +266,6 @@
 	@Override
 	public SessionResult getResult() {
-		List<Double> emptylist = new LinkedList<>();
-		for (int n = 0; n < getConnections().size(); n++)
-			emptylist.add(0d);
-		return new SessionResult(getSettings().getAllParties(), getAgreements(),
-				emptylist, getError());
+		return new SessionResult(getPartyProfiles(), getAgreements(),
+				Collections.emptyMap(), getError());
 	}
 
Index: protocol/src/main/java/geniusweb/protocol/session/shaop/BareSHAOPState.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/session/shaop/BareSHAOPState.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/session/shaop/BareSHAOPState.java	(revision 23)
@@ -1,9 +1,10 @@
 package geniusweb.protocol.session.shaop;
 
-import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
@@ -171,5 +172,5 @@
 	@Override
 	public SessionResult getResult() {
-		Double[] penalties = new Double[partyNumbers.size()];
+		Map<PartyId, Double> penalties = new HashMap<>();
 		for (PartyId party : partyNumbers.keySet()) {
 			Double spent = totalSpent.get(party);
@@ -179,8 +180,11 @@
 				spent = Math.max(0, Math.min(1.0, spent));
 			}
-			penalties[partyNumbers.get(party)] = spent;
-		}
-		return new SessionResult(getSettings().getAllParties(), getAgreements(),
-				Arrays.asList(penalties), getError());
+			penalties.put(party, spent);
+		}
+		Map<PartyId, PartyWithProfile> allparties = partyNumbers.keySet()
+				.stream().collect(Collectors.toMap(pid -> pid, pid -> settings
+						.getAllParties().get(partyNumbers.get(pid))));
+		return new SessionResult(allparties, getAgreements(), penalties,
+				getError());
 
 	}
Index: protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsState.java
===================================================================
--- protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsState.java	(revision 22)
+++ protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsState.java	(revision 23)
@@ -54,8 +54,9 @@
 	 */
 	public AllPermutationsState with(SessionResult result) {
-		if (!getNextSettings().getAllParties()
-				.equals(result.getParticipants())) {
-			throw new IllegalArgumentException("Inconsistent session result");
-		}
+		// FIXME do we really need this? Why is this not working?
+		// if (!new HashSet<PartyWithProfile>(getNextSettings().getAllParties())
+		// .equals(result.getParticipants().values())) {
+		// throw new IllegalArgumentException("Inconsistent session result");
+		// }
 		ArrayList<SessionResult> newresults = new ArrayList<>(results);
 		newresults.add(result);
