@Override
		public void cleanup(
				BSPPeer<NullWritable, NullWritable, NullWritable, NullWritable, JobMessage> peer)
				throws IOException {
			if (peer.getPeerIndex() == 0) {
				JobMessage result = peer.getCurrentMessage();
				while (result != null) {
					int peerInd = result.getSender();
					Matrix block = result.getResult();
					List<Matrix> peerResBlocks = resBlocks.get(peerInd);
					if (peerResBlocks == null) {
						peerResBlocks = new ArrayList<Matrix>();
					}
					peerResBlocks.add(block);
					resBlocks.put(peerInd, peerResBlocks);
					result = peer.getCurrentMessage();
				}

				Matrix[][] cBlocks = new Matrix[nbRowsA / blockSize][nbColsB
						/ blockSize];
				for (int i = 0; i < nbRowsA / blockSize; i++) {
					for (int j = 0; j < nbColsB / blockSize; j++) {
						cBlocks[i][j] = new Matrix(blockSize, blockSize);
						cBlocks[i][j].zeroes();
					}
				}
				for (Integer peerInd : indices.keySet()) {
					List<Matrix> peerResBlocks = resBlocks.get(peerInd);
					List<Integer[]> peerIndices = indices.get(peerInd);
					for (int i = 0; i < peerResBlocks.size(); i++) {
						Matrix resBlock = peerResBlocks.get(i);
						Integer[] inds = peerIndices.get(i);
						cBlocks[inds[0]][inds[1]] = cBlocks[inds[0]][inds[1]]
								.sum(resBlock);
					}
				}

				Matrix c = new Matrix(cBlocks, nbRowsA, nbColsB, blockSize);
				HamaConfiguration conf = peer.getConfiguration();
				Utils.writeMatrix(c.getValues(), new Path(conf.get(inputMatrixCPathString)), peer
						.getConfiguration());
			}
		}