public synchronized void receive(byte[] bytes, Link l){

		int messageType = Tools.getMessageType(bytes);

		switch (messageType) {
		case Constants.Payload:

			Payload payload = new Payload();
			payload.unmarshall(bytes);

			trackReceive(payload.number);

			// Send verification
			Verification ack = new Verification(payload.number);
			l.sendData(ack.marshall());

			break;

		case Constants.Node_Results:
			NodeResults results = new NodeResults();
			results.unmarshall(bytes);

			// Save all of the node's information
			int numSent = results.numberSent;
			int numRec = results.numberReceived;
			int sumSent = results.sumSent;
			int sumRec = results.sumReceived;

			resultsCount++;
			totalSent += numSent;
			totalReceived += numRec;
			totalSumSent += sumSent;
			totalSumReceived += sumRec;

			NodeResults resultsAck = new NodeResults(numSent, numRec, sumSent, sumRec);
			l.sendData(resultsAck.marshall());

			// If we've heard back from everybody, print
			if (resultsCount == peerList.size()){
				totalSent += sendTracker;
				totalReceived += receiveTracker;
				totalSumSent += sendSummation;
				totalSumReceived += receiveSummation;
				printCumulativeOutput();

			}

			l.close();

			break;

		case Constants.Node_Complete:

			NodeComplete completeMessage = new NodeComplete();
			completeMessage.unmarshall(bytes);

			Verification reply = new Verification(completeMessage.number);
			l.sendData(reply.marshall());

			finishCount++;

			if (finishCount == peerList.size()){
				synchronized (finishedLock) {
					allNodesFinished = true;
				}
			}

			l.close();

			break;
		default:
			System.out.println("Received unrecognized message: " + messageType);
			break;
		}
	}