[med-svn] [ray] 02/08: Imported Upstream version 2.3.1

Andreas Tille tille at debian.org
Thu Sep 25 15:09:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository ray.

commit 01b721df8aadeb7cf31cd85e2111ab931206010f
Author: Andreas Tille <tille at debian.org>
Date:   Thu Sep 25 16:53:18 2014 +0200

    Imported Upstream version 2.3.1
---
 Documentation/RELEASE_PROCEDURE.txt                |   7 +-
 Documentation/Releases.txt                         |   1 +
 MANUAL_PAGE.txt                                    |  21 +-
 Makefile                                           |   6 +-
 README.md                                          |   3 +
 RayPlatform/Makefile                               |   4 +-
 RayPlatform/README.md                              |   3 +
 RayPlatform/RayPlatform/actors/Actor.cpp           |   1 +
 RayPlatform/RayPlatform/actors/Playground.cpp      |  26 ++
 RayPlatform/RayPlatform/actors/Playground.h        |   7 +
 .../RayPlatform/communication/BufferedData.cpp     |  14 +-
 RayPlatform/RayPlatform/communication/Message.cpp  | 333 ++++++++++++--
 RayPlatform/RayPlatform/communication/Message.h    | 105 +++--
 .../RayPlatform/communication/MessageQueue.cpp     |  12 +-
 .../RayPlatform/communication/MessageRouter.cpp    | 107 +++--
 .../RayPlatform/communication/MessagesHandler.cpp  | 207 ++++++---
 .../RayPlatform/communication/MessagesHandler.h    |   6 +-
 .../communication/VirtualCommunicator.cpp          |  50 +--
 RayPlatform/RayPlatform/core/ComputeCore.cpp       | 485 ++++++++++++++++-----
 RayPlatform/RayPlatform/core/ComputeCore.h         |  13 +-
 RayPlatform/RayPlatform/core/OperatingSystem.cpp   |   4 +-
 RayPlatform/RayPlatform/core/RankProcess.h         |  10 +-
 RayPlatform/RayPlatform/cryptography/crypto.cpp    |   4 +-
 RayPlatform/RayPlatform/files/FileReader.cpp       |   4 +
 RayPlatform/RayPlatform/files/FileReader.h         |   1 +
 .../RayPlatform/handlers/MasterModeExecutor.cpp    |   4 +-
 .../RayPlatform/handlers/MessageTagExecutor.cpp    |   4 +-
 .../RayPlatform/handlers/SlaveModeExecutor.cpp     |   4 +-
 .../memory/ChunkAllocatorWithDefragmentation.cpp   |   6 +-
 .../RayPlatform/memory/DefragmentationGroup.cpp    |  36 +-
 .../RayPlatform/memory/DefragmentationLane.cpp     |   8 +-
 RayPlatform/RayPlatform/memory/DirtyBuffer.h       |   3 +
 RayPlatform/RayPlatform/memory/MyAllocator.cpp     |  12 +-
 .../RayPlatform/memory/ReusableMemoryStore.cpp     |  14 +-
 RayPlatform/RayPlatform/memory/RingAllocator.cpp   |  60 ++-
 RayPlatform/RayPlatform/memory/RingAllocator.h     |   1 +
 RayPlatform/RayPlatform/memory/allocator.cpp       |   2 +-
 RayPlatform/RayPlatform/profiling/TickLogger.cpp   |  12 +-
 .../routing/GraphImplementationDeBruijn.cpp        |   2 +-
 .../routing/GraphImplementationExperimental.cpp    |   2 +-
 .../routing/GraphImplementationGroup.cpp           |   2 +-
 .../routing/GraphImplementationKautz.cpp           |   2 +-
 .../routing/GraphImplementationRandom.cpp          |   2 +-
 RayPlatform/RayPlatform/routing/Polytope.cpp       |  18 +-
 RayPlatform/RayPlatform/routing/Torus.cpp          |  24 +-
 RayPlatform/RayPlatform/scheduling/SwitchMan.cpp   |  24 +-
 RayPlatform/RayPlatform/scheduling/TaskCreator.cpp |   4 +-
 .../RayPlatform/scheduling/VirtualProcessor.cpp    |  14 +-
 RayPlatform/RayPlatform/structures/MyHashTable.h   |  52 +--
 .../RayPlatform/structures/MyHashTableGroup.h      |  28 +-
 .../RayPlatform/structures/MyHashTableIterator.h   |   4 +-
 RayPlatform/RayPlatform/structures/MyStack.h       |   2 +-
 .../RayPlatform/structures/SplayTreeIterator.h     |   2 +-
 .../RayPlatform/structures/StaticVector.cpp        |   4 +-
 code/CoverageGatherer/CoverageDistribution.cpp     |   2 +-
 code/CoverageGatherer/CoverageGatherer.cpp         |  14 +-
 code/EdgePurger/EdgePurger.cpp                     |   6 +-
 code/FusionData/FusionData.cpp                     |  24 +-
 code/FusionTaskCreator/FusionWorker.cpp            |   4 +-
 code/GeneOntology/GeneOntology.cpp                 |  47 +-
 code/GeneOntology/KeyEncoder.cpp                   |  14 +-
 code/GenomeNeighbourhood/GenomeNeighbourhood.cpp   |  28 +-
 code/JoinerTaskCreator/JoinerWorker.cpp            |  16 +-
 code/KmerAcademyBuilder/BloomFilter.cpp            |  22 +-
 code/KmerAcademyBuilder/Kmer.h                     |   2 +-
 code/KmerAcademyBuilder/KmerAcademyBuilder.cpp     |  10 +-
 code/Library/Library.cpp                           |  12 +-
 code/Library/LibraryWorker.cpp                     |  10 +-
 code/MachineHelper/MachineHelper.cpp               |  19 +-
 code/MessageProcessor/MessageProcessor.cpp         | 114 ++---
 code/Mock/Mock.cpp                                 |   4 +-
 code/Mock/Parameters.cpp                           |  56 ++-
 code/Mock/common_functions.cpp                     |   4 +-
 code/Mock/common_functions.h                       |   2 +-
 code/NetworkTest/NetworkTest.cpp                   |   4 +-
 code/Partitioner/Partitioner.cpp                   |   4 +-
 code/Scaffolder/Scaffolder.cpp                     |  38 +-
 code/Scaffolder/ScaffoldingAlgorithm.cpp           |  10 +-
 code/Scaffolder/ScaffoldingEdge.cpp                |   4 +-
 code/Searcher/ColorSet.cpp                         |  71 +--
 code/Searcher/ColorSet.h                           |   5 +-
 code/Searcher/DistributionWriter.cpp               |   2 +-
 code/Searcher/QualityCaller.cpp                    |   2 +-
 code/Searcher/SearchDirectory.cpp                  |  56 +--
 code/Searcher/Searcher.cpp                         | 152 +++----
 code/Searcher/VirtualKmerColor.cpp                 |  10 +-
 code/SeedExtender/BubbleTool.cpp                   |  10 +-
 code/SeedExtender/DepthFirstSearchData.cpp         |  14 +-
 code/SeedExtender/Direction.cpp                    |   2 +-
 code/SeedExtender/ReadFetcher.cpp                  |  16 +-
 code/SeedExtender/SeedExtender.cpp                 |  74 ++--
 code/SeedExtender/VertexMessenger.cpp              |   6 +-
 code/SeedingData/PathHandle.cpp                    |  21 +-
 code/SeedingData/PathHandle.h                      |  15 +-
 code/SeedingData/SeedWorker.cpp                    |   4 +-
 code/SeedingData/SeedingData.cpp                   |  31 +-
 code/SequencesIndexer/IndexerWorker.cpp            |  12 +-
 code/SequencesIndexer/SequencesIndexer.cpp         |  12 +-
 code/SequencesLoader/ArrayOfReads.cpp              |  26 +-
 code/SequencesLoader/BzReader.cpp                  |   2 +-
 code/SequencesLoader/FastqGzLoader.cpp             |  14 +-
 code/SequencesLoader/Loader.cpp                    |   8 +-
 code/SequencesLoader/Read.cpp                      |   2 +-
 code/SequencesLoader/SequenceFileDetector.cpp      |  10 +
 code/SequencesLoader/SequencesLoader.cpp           |  26 +-
 .../SpuriousSeedAnnihilator/AnnihilationWorker.cpp |   6 +-
 code/SpuriousSeedAnnihilator/AttributeFetcher.cpp  |   2 +-
 code/SpuriousSeedAnnihilator/GraphExplorer.cpp     |   6 +-
 .../SeedFilteringWorkflow.cpp                      |   4 +-
 .../SeedMergingWorkflow.cpp                        |   4 +-
 .../SpuriousSeedAnnihilator.cpp                    |  16 +-
 code/Surveyor/CoalescenceManager.cpp               |  33 +-
 code/Surveyor/GenomeGraphReader.cpp                |  51 ++-
 code/Surveyor/GenomeGraphReader.h                  |   3 +
 code/Surveyor/MatrixOwner.cpp                      |  47 +-
 code/Surveyor/MatrixOwner.h                        |   4 +
 code/Surveyor/Mother.cpp                           | 130 ++++--
 code/Surveyor/Mother.h                             |   6 +-
 code/Surveyor/StoreKeeper.cpp                      | 179 +++++++-
 code/Surveyor/StoreKeeper.h                        |   2 +
 code/TaxonomyViewer/TaxonomyViewer.cpp             |  52 ++-
 code/VerticesExtractor/GridTable.cpp               |  34 +-
 code/VerticesExtractor/GridTableIterator.cpp       |   2 +-
 code/VerticesExtractor/Vertex.cpp                  |  16 +-
 code/VerticesExtractor/VerticesExtractor.cpp       |  10 +-
 code/application_core/Machine.cpp                  |   2 +-
 code/application_core/Machine.h                    |   2 +-
 127 files changed, 2339 insertions(+), 1131 deletions(-)

diff --git a/Documentation/RELEASE_PROCEDURE.txt b/Documentation/RELEASE_PROCEDURE.txt
index c424f43..a2ace40 100644
--- a/Documentation/RELEASE_PROCEDURE.txt
+++ b/Documentation/RELEASE_PROCEDURE.txt
@@ -1,5 +1,6 @@
-* run regression tests (+backup on colosse)
-* run unit tests
+* run system-tests (document in a github ticket)
+* run unit-tests
+* run robustness-tests
 * compile with make
 * compile with cmake
 
@@ -12,7 +13,7 @@
 * upload the tarball on sf
 * update the web site (download + manual)
 
-* post an email on the list including changes (dump-changes)
+* post an email on the list including changes
 * update the seqanswer thread
 * Google+
 * Twitter
diff --git a/Documentation/Releases.txt b/Documentation/Releases.txt
index a26a751..9a21bf9 100644
--- a/Documentation/Releases.txt
+++ b/Documentation/Releases.txt
@@ -3,6 +3,7 @@ available at
 - http://sourceforge.net/projects/denovoassembler/files/
 - https://github.com/sebhtml/Ray-Releases
 
+2014-02-12	Ray v2.3.1 "Distributed Pumpkin"		RayPlatform v2.0.1 "Actor Nest"
 2013-10-31	Ray v2.3.0 "Distributed Pumpkin"		RayPlatform v2.0.0 "Actor Nest"
 2013-04-17	Ray v2.2.0 "Cloudy Sky of Wishes"		RayPlatform v1.1.1 "Nested Droids of Luck"
 2012-10-30	Ray v2.1.0 "Ancient Granularity of Epochs"	RayPlatform v1.1.0 "Chariot of Complexity"
diff --git a/MANUAL_PAGE.txt b/MANUAL_PAGE.txt
index 0a2afac..991fbd7 100644
--- a/MANUAL_PAGE.txt
+++ b/MANUAL_PAGE.txt
@@ -27,6 +27,8 @@ DESCRIPTION:
     - taxonomy profiling of samples (with Ray Communities)
     - gene ontology profiling of samples (with Ray Ontologies)
 
+    - compare DNA samples using words (Ray -run-surveyor ...; see Ray Surveyor options)
+
        -help
               Displays this help page.
 
@@ -85,6 +87,17 @@ DESCRIPTION:
               Specifies the directory for outputted files. Default is RayOutput
               Other name: -output
 
+  Ray Surveyor options
+
+       -run-surveyor
+              Runs Ray Surveyor to compare samples.
+              See Documentation/Ray-Surveyor.md
+              This workflow generates:
+              RayOutput/Surveyor/SimilarityMatrix.tsv is a similarity Gramian matrix based on shared DNA words
+              RayOutput/Surveyor/DistanceMatrix.tsv is a distance matrix (kernel-based).
+       -read-sample-graph SampleName SampleGraphFile
+              Reads a sample graph (generated with -write-kmers)
+
   Assembly options (defaults work well)
 
        -disable-recycling
@@ -109,6 +122,9 @@ DESCRIPTION:
        -disable-scaffolder
               Disables the scaffolder.
 
+       -minimum-seed-length minimumSeedLength
+              Changes the minimum seed length, default is 100 nucleotides
+
        -minimum-contig-length minimumContigLength
               Changes the minimum contig length, default is 100 nucleotides
 
@@ -185,6 +201,9 @@ DESCRIPTION:
               The resulting file is not utilised by Ray.
               The resulting file is very large.
 
+       -graph-only
+              Exits after building graph.
+
        -write-read-markers
               Writes read markers to disk.
 
@@ -460,4 +479,4 @@ COPYRIGHT
        You have received a copy of the GNU General Public License
        along with this program (see LICENSE).
 
-Ray 2.3.0
+Ray 2.3.1
diff --git a/Makefile b/Makefile
index 1703af9..5a1ba0c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 3
-SUBLEVEL = 0
+SUBLEVEL = 1
 EXTRAVERSION =
 NAME = Distributed Pumpkin
 
@@ -123,7 +123,7 @@ CONFIG_FLAGS-y=
 CONFIG_FLAGS-y += -D CONFIG_MAXKMERLENGTH=$(MAXKMERLENGTH)
 
 # compile assertions
-CONFIG_FLAGS-$(CONFIG_ASSERT) += -D CONFIG_ASSERT -D ASSERT
+CONFIG_FLAGS-$(CONFIG_ASSERT) += -D CONFIG_ASSERT
 
 #compile with zlib
 CONFIG_FLAGS-$(CONFIG_HAVE_LIBZ) += -D CONFIG_HAVE_LIBZ
@@ -225,6 +225,6 @@ install:
 
 	$(Q)mkdir $(PREFIX)/RayPlatform
 	$(Q)cp RayPlatform/AUTHORS $(PREFIX)/RayPlatform
-	$(Q)cp RayPlatform/README $(PREFIX)/RayPlatform
+	$(Q)cp RayPlatform/README.md $(PREFIX)/RayPlatform
 	$(Q)cp -r RayPlatform/Documentation $(PREFIX)/RayPlatform
 
diff --git a/README.md b/README.md
index b8276a1..36c1df7 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,9 @@
 Ray is a parallel de novo genome assembler that utilises the message-passing interface everywhere
 and is implemented using peer-to-peer communication.
 
+Ray is free software distributed under the terms of the GNU General Public License,
+version 3 (GPLv3).
+
 Ray is implemented using RayPlatform, a message-passing-interface programming framework.
 
 Ray is documented in
diff --git a/RayPlatform/Makefile b/RayPlatform/Makefile
index 2c13fc3..e48d2a3 100644
--- a/RayPlatform/Makefile
+++ b/RayPlatform/Makefile
@@ -5,7 +5,7 @@
 
 VERSION = 2
 PATCHLEVEL = 0
-SUBLEVEL = 0
+SUBLEVEL = 1
 EXTRAVERSION =
 NAME =  Actor Nest
 
@@ -24,7 +24,7 @@ libRayPlatform.a: $(obj-y)
 CONFIG_ASSERT=$(ASSERT)
 
 CONFIG_FLAGS-y=
-CONFIG_FLAGS-$(CONFIG_ASSERT) += -D CONFIG_ASSERT -D ASSERT
+CONFIG_FLAGS-$(CONFIG_ASSERT) += -D CONFIG_ASSERT
 CONFIG_FLAGS=$(CONFIG_FLAGS-y)
 
 # inference rule
diff --git a/RayPlatform/README.md b/RayPlatform/README.md
index ba5f010..5be48a2 100644
--- a/RayPlatform/README.md
+++ b/RayPlatform/README.md
@@ -1,6 +1,9 @@
 RayPlatform is a development framework to ease the creation of 
 massively distributed high performance computing applications.
 
+RayPlatform is free software distributed under the terms of the GNU
+Lesser General Public License, version 3 (LGPLv3).
+
 Content creation is done by creating plugins that can be 
 added on the RayPlatform compute engine.
 
diff --git a/RayPlatform/RayPlatform/actors/Actor.cpp b/RayPlatform/RayPlatform/actors/Actor.cpp
index 9879b3e..1006a23 100644
--- a/RayPlatform/RayPlatform/actors/Actor.cpp
+++ b/RayPlatform/RayPlatform/actors/Actor.cpp
@@ -27,6 +27,7 @@
 #include <RayPlatform/communication/Message.h>
 #include <RayPlatform/core/ComputeCore.h>
 #include <RayPlatform/cryptography/crypto.h>
+#include <string.h>
 
 #include <iostream>
 using namespace std;
diff --git a/RayPlatform/RayPlatform/actors/Playground.cpp b/RayPlatform/RayPlatform/actors/Playground.cpp
index b454856..9afa470 100644
--- a/RayPlatform/RayPlatform/actors/Playground.cpp
+++ b/RayPlatform/RayPlatform/actors/Playground.cpp
@@ -34,6 +34,10 @@ Playground::Playground() {
 
 	m_actorIterator = 0;
 	m_aliveActors = 0;
+
+	m_zombieActors = 0;
+	m_deadActors = 0;
+	m_bornActors = 0;
 }
 
 Playground::~Playground() {
@@ -60,6 +64,8 @@ void Playground::spawnActor(Actor * actor) {
 	m_actorIterator++;
 
 	m_aliveActors ++;
+
+	m_bornActors ++;
 }
 
 void Playground::sendActorMessage(Message * message) {
@@ -153,6 +159,9 @@ void Playground::receiveActorMessage(Message * message) {
 
 		m_aliveActors --;
 
+		m_deadActors ++;
+		m_zombieActors += 0;
+
 		/*
 		cout << "DEBUG Playground actor " << actor->getName() << " died, remaining: ";
 		cout << m_aliveActors << endl;
@@ -209,3 +218,20 @@ RingAllocator * Playground::getOutboxAllocator() {
 
 	return getComputeCore()->getOutboxAllocator();
 }
+
+int Playground::getNumberOfAliveActors() const {
+
+	return m_aliveActors;
+}
+
+void Playground::printStatus() const {
+
+	cout << "[Playground] Actors: ";
+	cout << "| Born " << m_bornActors;
+	cout << "| Dead " << m_deadActors;
+	cout << "| Defunct " << m_zombieActors;
+	cout << "| Alive " << m_aliveActors;
+
+	cout << endl;
+
+}
diff --git a/RayPlatform/RayPlatform/actors/Playground.h b/RayPlatform/RayPlatform/actors/Playground.h
index 411e5fa..5907528 100644
--- a/RayPlatform/RayPlatform/actors/Playground.h
+++ b/RayPlatform/RayPlatform/actors/Playground.h
@@ -41,6 +41,9 @@ private:
 	vector<Actor*> m_actors;
 	int m_actorIterator;
 	int m_aliveActors;
+	int m_deadActors;
+	int m_zombieActors;
+	int m_bornActors;
 	ComputeCore * m_computeCore;
 
 public:
@@ -76,6 +79,10 @@ public:
 
 	int getRank() const;
 	int getSize() const;
+
+	int getNumberOfAliveActors() const;
+
+	void printStatus() const;
 };
 
 #endif
diff --git a/RayPlatform/RayPlatform/communication/BufferedData.cpp b/RayPlatform/RayPlatform/communication/BufferedData.cpp
index 92ec9b3..caa1ce5 100644
--- a/RayPlatform/RayPlatform/communication/BufferedData.cpp
+++ b/RayPlatform/RayPlatform/communication/BufferedData.cpp
@@ -56,7 +56,7 @@ void BufferedData::constructor(int numberOfRanks,int capacity,const char*type,bo
 }
 
 void BufferedData::clear(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(isEmpty());
 	#endif
 
@@ -71,7 +71,7 @@ void BufferedData::clear(){
 }
 
 int BufferedData::size(int i)const{
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(i>=m_ranks){
 		cout<<"i="<<i<<" m_ranks="<<m_ranks<<endl;
 	}
@@ -97,7 +97,7 @@ void BufferedData::addAt(int i,MessageUnit k){
 
 void BufferedData::reset(int i){
 	m_sizes[i]=0;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_sizes[i]==0);
 	#endif
 }
@@ -133,7 +133,7 @@ int BufferedData::flushAll(int tag,RingAllocator*outboxAllocator,StaticVector*ou
 			flushed++;
 			return flushed;
 		}
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(size(i)==0);
 		#endif
 	}
@@ -141,7 +141,7 @@ int BufferedData::flushAll(int tag,RingAllocator*outboxAllocator,StaticVector*ou
 }
 
 bool BufferedData::flush(int destination,int period,int tag,RingAllocator*outboxAllocator,StaticVector*outbox,int rank,bool force){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(!force){
 		assert(period!=0);
 	}
@@ -152,7 +152,7 @@ bool BufferedData::flush(int destination,int period,int tag,RingAllocator*outbox
 		threshold=(m_capacity/period)*period;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(threshold<=m_capacity);
 	#endif
 
@@ -163,7 +163,7 @@ bool BufferedData::flush(int destination,int period,int tag,RingAllocator*outbox
 	if(amount==0){
 		return false;
 	}
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(amount>0);
 	if(!force && amount>threshold){
 		cout<<"Threshold is exceeded "<<amount<<" & "<<threshold<<" tag="<<tag<<endl;
diff --git a/RayPlatform/RayPlatform/communication/Message.cpp b/RayPlatform/RayPlatform/communication/Message.cpp
index ddb2b23..5c2896c 100644
--- a/RayPlatform/RayPlatform/communication/Message.cpp
+++ b/RayPlatform/RayPlatform/communication/Message.cpp
@@ -14,7 +14,7 @@
     GNU Lesser General Public License for more details.
 
     You have received a copy of the GNU Lesser General Public License
-    along with this program (lgpl-3.0.txt).  
+    along with this program (lgpl-3.0.txt).
 	see <http://www.gnu.org/licenses/>
 
 */
@@ -25,6 +25,7 @@
 #include <RayPlatform/cryptography/crypto.h>
 
 #include <iostream>
+#include <iomanip>
 using namespace std;
 
 #include <string.h>
@@ -33,7 +34,11 @@ using namespace std;
 #include <assert.h>
 #endif
 
-#define ACTOR_MODEL_NOBODY -1
+#include <stdio.h>
+
+#define NO_VALUE -1
+#define ACTOR_MODEL_NOBODY NO_VALUE
+#define ROUTING_NO_VALUE NO_VALUE
 
 /**
  * We always pad the buffer with actor source and actor destination.
@@ -42,12 +47,6 @@ using namespace std;
  *
 
  */
-#define MESSAGE_META_DATA_ACTOR_SOURCE		0
-#define MESSAGE_META_DATA_ACTOR_DESTINATION	4
-#define MESSAGE_META_DATA_ROUTE_SOURCE	 	8
-#define MESSAGE_META_DATA_ROUTE_DESTINATION	12
-#define MESSAGE_META_DATA_CHECKSUM	 	16
-
 
 Message::Message() {
 
@@ -63,13 +62,21 @@ void Message::initialize() {
 	m_destination = 0;
 	m_sourceActor = ACTOR_MODEL_NOBODY;
 	m_destinationActor = ACTOR_MODEL_NOBODY;
+
+	m_routingSource = ROUTING_NO_VALUE;
+	m_routingDestination = ROUTING_NO_VALUE;
+
+	m_miniRankSource = NO_VALUE;
+	m_miniRankDestination = NO_VALUE;
 }
 
 Message::~Message() {
 }
 
-/** buffer must be allocated or else it will CORE DUMP. */
-Message::Message(MessageUnit*b,int c,Rank dest,MessageTag tag,Rank source){
+/**
+ * buffer must be allocated or else it will CORE DUMP.
+ */
+Message::Message(void*b,int c,Rank dest,MessageTag tag,Rank source){
 
 	initialize();
 
@@ -114,22 +121,64 @@ int Message::getSource() const{
 }
 
 void Message::print(){
-	uint8_t shortTag=getTag();
+	//uint8_t shortTag=getTag();
 
 	cout<<"Source: "<<getSource()<<" Destination: "<<getDestination();
 
-	if(isActorModelMessage()) {
+	/*
+	if(isActorModelMessage(0)) {
 		cout << " ActorModel: Yes.";
 	} else {
 		cout <<" Tag: "<<MESSAGE_TAGS[shortTag];
 	}
+	*/
 
 	cout<<" RealTag: "<<getTag();
 	cout<<" Count: "<<getCount();
 
+	/*
 	if(getCount() > 0){
 		cout<<" Overlay: "<<getBuffer()[0];
 	}
+	*/
+
+	cout << " Bytes: " << m_bytes;
+	cout << " SourceActor: " << m_sourceActor;
+	cout << " DestinationActor: " << m_destinationActor;
+	cout << " RoutingSource: " << m_routingSource;
+	cout << " RoutingDestination: " << m_routingDestination;
+	cout << " MiniRankSource: " << m_miniRankSource;
+	cout << " MiniRankDestination: " << m_miniRankDestination;
+
+	printBuffer(getBufferBytes(), getNumberOfBytes());
+
+	cout << endl;
+}
+
+void Message::printBuffer(const char * buffer, int bytes) const {
+
+	cout << " Buffer: " << (void*) buffer;
+	cout << " with " << bytes << " bytes : ";
+
+	for(int i = 0 ; i < bytes ; ++i) {
+
+		char byte = buffer[i];
+		/*
+		 * this does not work
+		cout << " 0x" << hex << setfill('0') << setw(2);
+		cout << byte;
+		cout << dec;
+		*/
+
+		/*
+		 * C solution
+		 * \see http://stackoverflow.com/questions/8060170/printing-hexadecimal-characters-in-c
+		 * \see http://stackoverflow.com/questions/10599068/how-do-i-print-bytes-as-hexadecimal
+		 */
+		printf(" 0x%02x", byte & 0xff);
+		cout << dec;
+	}
+	cout << endl;
 }
 
 void Message::setBuffer(void *buffer){
@@ -153,10 +202,20 @@ void Message::setDestination(Rank destination){
 	m_destination=destination;
 }
 
-bool Message::isActorModelMessage() const {
+bool Message::isActorModelMessage(int size) const {
 
-	return ( m_sourceActor != ACTOR_MODEL_NOBODY
-		       	&& m_destinationActor != ACTOR_MODEL_NOBODY );
+	// source actor is actually a MPI rank !
+	// this method is only important to the destination actor.
+	if(false && m_sourceActor < size)
+		return false;
+
+	// destination actor is actually a MPI rank
+	if(m_destinationActor < size)
+		return false;
+
+	// otherwise, it is an actor message !
+
+	return true;
 }
 
 
@@ -178,6 +237,9 @@ void Message::setDestinationActor(int destinationActor) {
 
 void Message::saveActorMetaData() {
 
+	// actor model metadata is the first to be saved.
+	// So we don't have anything to remove from offset.
+
 	// write rank numbers for these.
 	// MPI ranks actually have actor names too !
 	if(m_sourceActor < 0 && m_destinationActor < 0) {
@@ -193,9 +255,16 @@ void Message::saveActorMetaData() {
 		cout << "Error m_sourceActor " << m_sourceActor;
 		printActorMetaData();
 	}
-	assert(m_sourceActor >= 0);
-	assert(m_destinationActor >= 0);
+	assert(m_sourceActor >= 0 || m_sourceActor == ACTOR_MODEL_NOBODY);
+	assert(m_destinationActor >= 0 || m_destinationActor == ACTOR_MODEL_NOBODY);
+
+	// check that the overwrite worked.
+	/*
+	assert(m_sourceActor != ACTOR_MODEL_NOBODY);
+	assert(m_destinationActor != ACTOR_MODEL_NOBODY);
+	*/
 #endif
+
 	//cout << "DEBUG saveActorMetaData tag " << getTag() << endl;
 
 	int offset = getNumberOfBytes();
@@ -209,7 +278,6 @@ void Message::saveActorMetaData() {
 	memcpy(memory + offset + MESSAGE_META_DATA_ACTOR_DESTINATION, &m_destinationActor, sizeof(int));
 	//printActorMetaData();
 
-	setNumberOfBytes(getNumberOfBytes() + 2 * sizeof(int));
 	//setCount(m_count + 1);
 	//m_count += 1; // add 1 uint64_t
 
@@ -240,9 +308,10 @@ void Message::loadActorMetaData() {
 	printActorMetaData();
 	cout << endl;
 */
-	// m_count already contains the actor metadata.
+	// the buffer contains the actor metadata. and routing metadata.
 	int offset = getNumberOfBytes();
-	offset -= 2 * sizeof(int);
+	//offset -= 2 * sizeof(int);
+	//offset -= 2 * sizeof(int);
 
 	char * memory = (char*) getBuffer();
 
@@ -255,8 +324,8 @@ void Message::loadActorMetaData() {
 	cout << " m_destinationActor= " << m_destinationActor << endl;
 */
 	// remove 1 uint64_t
-	
-	setNumberOfBytes(getNumberOfBytes() - 2 * sizeof(int));
+
+	//setNumberOfBytes(getNumberOfBytes() - 2 * sizeof(int));
 	//setCount(m_count - 1);
 	//m_count -= 1;
 /*
@@ -266,8 +335,13 @@ void Message::loadActorMetaData() {
 	*/
 
 #ifdef CONFIG_ASSERT
-	assert(m_sourceActor >= 0);
-	assert(m_destinationActor >= 0);
+	if(!(m_sourceActor >= 0 || m_sourceActor == ACTOR_MODEL_NOBODY)) {
+		cout << "Error: m_sourceActor " << m_sourceActor << endl;
+		print();
+	}
+
+	assert(m_sourceActor >= 0 || m_sourceActor == ACTOR_MODEL_NOBODY);
+	assert(m_destinationActor >= 0 || m_destinationActor == ACTOR_MODEL_NOBODY);
 #endif
 
 }
@@ -289,8 +363,8 @@ void Message::setRoutingDestination(int destination) {
 void Message::saveRoutingMetaData() {
 
 #ifdef CONFIG_ASSERT
-	assert(m_routingSource >= 0);
-	assert(m_routingDestination >= 0);
+	assert(m_routingSource >= 0 || m_routingSource == ROUTING_NO_VALUE);
+	assert(m_routingDestination >= 0 || m_routingDestination == ROUTING_NO_VALUE);
 #endif
 
 	/*
@@ -303,17 +377,23 @@ void Message::saveRoutingMetaData() {
 	// the count already includes the actor addresses
 	// this is stupid, but hey, nobody aside me is touching this code
 	// with a ten-foot stick
-	offset -= 2 * sizeof(int);
+	// 2013-11-18: this was fixed by grouping the  changes to count in saveMetaData().
+	//offset -= 2 * sizeof(int);
 
 	memcpy(memory + offset + MESSAGE_META_DATA_ROUTE_SOURCE, &m_routingSource, sizeof(int));
 	memcpy(memory + offset + MESSAGE_META_DATA_ROUTE_DESTINATION, &m_routingDestination, sizeof(int));
 	//printActorMetaData();
 
-	setNumberOfBytes(getNumberOfBytes() + 2 * sizeof(int));
+	//setNumberOfBytes(getNumberOfBytes() + 2 * sizeof(int));
 	//m_count += 1; // add 1 uint64_t
 
 	//cout << "DEBUG saved routing metadata at offset " << offset << " new count " << m_count << endl;
 	//displayMetaData();
+
+#ifdef CONFIG_ASSERT
+	//assert(getNumberOfBytes() <= (int)(MAXIMUM_MESSAGE_SIZE_IN_BYTES + 4 * sizeof(int)));
+#endif
+
 }
 
 
@@ -333,18 +413,29 @@ void Message::loadRoutingMetaData() {
 	int offset = getNumberOfBytes();
 
 	// m_count contains actor metadata *AND* routing metadata (if necessary)
+	/*
 	offset -= 2 * sizeof(int);
 	offset -= 2 * sizeof(int);
+	*/
+
+	//cout << "Bytes before: " << m_bytes << endl;
 
 	char * memory = (char*) getBuffer();
 
+#ifdef CONFIG_ASSERT
+	assert(memory != NULL);
+#endif
+
+	//cout << "DEBUG memory " << (void*)memory << " offset " << offset;
+	//cout << " MESSAGE_META_DATA_ROUTE_SOURCE " << MESSAGE_META_DATA_ROUTE_SOURCE << endl;
+
 	memcpy(&m_routingSource, memory + offset + MESSAGE_META_DATA_ROUTE_SOURCE, sizeof(int));
 	memcpy(&m_routingDestination, memory + offset + MESSAGE_META_DATA_ROUTE_DESTINATION, sizeof(int));
 
-	setNumberOfBytes(getNumberOfBytes() - 2 * sizeof(int));
+	//setNumberOfBytes(getNumberOfBytes() - 2 * sizeof(int));
 	//m_count -= 1;
 
-	/*
+#if 0
 	cout << "DEBUG loadRoutingMetaData ";
 	cout << "loaded m_routingSource ";
 	cout << m_routingSource;
@@ -352,15 +443,24 @@ void Message::loadRoutingMetaData() {
 	cout << " offset " << offset ;
 	printActorMetaData();
 	cout << endl;
-	*/
+#endif
 
 	//displayMetaData();
 
 	// these can not be negative, otherwise
 	// this method would not have been called now.
 #ifdef CONFIG_ASSERT
-	assert(m_routingSource >= 0);
-	assert(m_routingDestination >= 0);
+	if(!((m_routingSource >= 0 || m_routingSource == ROUTING_NO_VALUE))) {
+		print();
+	}
+
+	if(!(m_routingDestination >= 0 || m_routingDestination == ROUTING_NO_VALUE)) {
+
+		print();
+	}
+
+	assert(m_routingSource >= 0 || m_routingSource == ROUTING_NO_VALUE);
+	assert(m_routingDestination >= 0 || m_routingDestination == ROUTING_NO_VALUE);
 #endif
 }
 
@@ -387,3 +487,170 @@ void Message::setNumberOfBytes(int bytes) {
 int Message::getNumberOfBytes() const {
 	return m_bytes;
 }
+
+void Message::runAssertions(int size, bool routing, bool miniRanks) {
+
+#ifdef CONFIG_ASSERT
+
+	assert(m_source >= 0);
+	assert(m_source < size);
+
+	assert(m_destination >= 0);
+	assert(m_destination < size);
+
+	assert(m_sourceActor >= 0);
+	assert(m_destinationActor >= 0);
+
+	if(miniRanks) {
+		if(!(m_miniRankSource >= 0)) {
+			print();
+		}
+
+		assert(m_miniRankSource >= 0);
+
+		if(!(m_miniRankSource < size )) {
+
+			cout << "Error" << endl;
+			print();
+			cout << "m_miniRankSource " << m_miniRankSource;
+			cout << " size " << size << endl;
+
+		}
+		assert(m_miniRankSource < size );
+
+
+		assert(m_miniRankDestination >= 0);
+		assert(m_miniRankDestination < size);
+
+
+	} else {
+		assert(m_miniRankSource == NO_VALUE);
+		assert(m_miniRankDestination == NO_VALUE);
+		assert(m_miniRankDestination == NO_VALUE);
+	}
+
+	if(routing) {
+
+		// m_routingSource and m_routingDestination are
+		// valued at NO_VALUE
+
+		if(m_routingSource == NO_VALUE) {
+		} else {
+			assert(m_routingSource >= 0);
+			assert(m_routingSource < size );
+		}
+
+		if(m_routingDestination == NO_VALUE) {
+		} else {
+			assert(m_routingDestination >= 0 );
+			assert(m_routingDestination < size);
+		}
+	} else {
+
+		if(!(m_routingSource == NO_VALUE)) {
+			print();
+		}
+		assert( m_routingSource == ROUTING_NO_VALUE);
+		assert( m_routingSource == NO_VALUE);
+
+		assert( m_routingDestination == ROUTING_NO_VALUE);
+		assert( m_routingDestination == NO_VALUE);
+	}
+
+#endif
+
+}
+
+void Message::saveMetaData() {
+
+	//runAssertions(size);
+
+#ifdef CONFIG_ASSERT
+
+	int bytes = getNumberOfBytes();
+	uint32_t checksumBefore = computeCyclicRedundancyCode32((uint8_t*)getBuffer(), bytes);
+#endif
+
+	this->saveMiniRankMetaData();
+	this->saveActorMetaData();
+	this->saveRoutingMetaData();
+
+#ifdef CONFIG_ASSERT
+	assert(getNumberOfBytes() >= 0);
+	assert(getNumberOfBytes() <= MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+
+	uint32_t checksumAfter = computeCyclicRedundancyCode32((uint8_t*)getBuffer(), bytes);
+
+	assert(checksumBefore == checksumAfter);
+#endif
+
+	// we need this for the transfer.
+	setNumberOfBytes(getNumberOfBytes() + MESSAGE_META_DATA_SIZE);
+}
+
+void Message::loadMetaData() {
+
+	// we just needed this for the transfer.
+	setNumberOfBytes(getNumberOfBytes() - MESSAGE_META_DATA_SIZE);
+
+	//cout << "loadMetaData MESSAGE_META_DATA_SIZE " << MESSAGE_META_DATA_SIZE << endl;
+
+	//cout << "loadMetaData bytes: " << getNumberOfBytes() << endl;
+
+#ifdef CONFIG_ASSERT
+	assert(getNumberOfBytes() >= 0);
+	if(!(getNumberOfBytes() <= MAXIMUM_MESSAGE_SIZE_IN_BYTES)) {
+		cout << "Error: " << getNumberOfBytes() << endl;
+	}
+	assert(getNumberOfBytes() <= MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+#endif
+
+	this->loadRoutingMetaData();
+	this->loadActorMetaData();
+	this->loadMiniRankMetaData();
+
+}
+
+void Message::saveMiniRankMetaData() {
+
+	int sourceMiniRank = getSourceMiniRank();
+	int destinationMiniRank = getDestinationMiniRank();
+
+	memcpy(getBufferBytes() + getNumberOfBytes() + MESSAGE_META_DATA_MINIRANK_SOURCE,
+			&sourceMiniRank, sizeof(sourceMiniRank));
+
+	memcpy(getBufferBytes() + getNumberOfBytes() + MESSAGE_META_DATA_MINIRANK_DESTINATION,
+			&destinationMiniRank, sizeof(destinationMiniRank));
+}
+
+void Message::loadMiniRankMetaData() {
+
+	int sourceMiniRank = -1;
+	int destinationMiniRank = -1;
+
+	memcpy(
+			&sourceMiniRank,
+			getBufferBytes() + getNumberOfBytes() + MESSAGE_META_DATA_MINIRANK_SOURCE,
+			sizeof(sourceMiniRank));
+
+	memcpy(
+			&destinationMiniRank,
+			getBufferBytes() + getNumberOfBytes() + MESSAGE_META_DATA_MINIRANK_DESTINATION,
+			sizeof(destinationMiniRank));
+
+	setMiniRanks(sourceMiniRank, destinationMiniRank);
+}
+
+void Message::setMiniRanks(int source, int destination) {
+
+	m_miniRankSource = source;
+	m_miniRankDestination = destination;
+}
+
+int Message::getSourceMiniRank() {
+	return m_miniRankSource;
+}
+
+int Message::getDestinationMiniRank() {
+	return m_miniRankDestination;
+}
diff --git a/RayPlatform/RayPlatform/communication/Message.h b/RayPlatform/RayPlatform/communication/Message.h
index b60b6d3..89e777a 100644
--- a/RayPlatform/RayPlatform/communication/Message.h
+++ b/RayPlatform/RayPlatform/communication/Message.h
@@ -1,48 +1,59 @@
 /*
- 	RayPlatform: a message-passing development framework
-    Copyright (C) 2010, 2011, 2012 Sébastien Boisvert
+RayPlatform: a message-passing development framework
+Copyright (C) 2010, 2011, 2012 Sébastien Boisvert
 
-	http://github.com/sebhtml/RayPlatform
+http://github.com/sebhtml/RayPlatform
 
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation, version 3 of the License.
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, version 3 of the License.
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
 
-    You have received a copy of the GNU Lesser General Public License
-    along with this program (lgpl-3.0.txt).
-	see <http://www.gnu.org/licenses/>
+You have received a copy of the GNU Lesser General Public License
+along with this program (lgpl-3.0.txt).
+see <http://www.gnu.org/licenses/>
 
 */
 
 #ifndef _Message_H
 #define _Message_H
 
+#define MESSAGE_META_DATA_ACTOR_SOURCE		0
+#define MESSAGE_META_DATA_ACTOR_DESTINATION	( MESSAGE_META_DATA_ACTOR_SOURCE + sizeof(int) )
+#define MESSAGE_META_DATA_ROUTE_SOURCE	 	( MESSAGE_META_DATA_ACTOR_DESTINATION + sizeof(int) )
+#define MESSAGE_META_DATA_ROUTE_DESTINATION	( MESSAGE_META_DATA_ROUTE_SOURCE + sizeof(int))
+#define MESSAGE_META_DATA_MINIRANK_SOURCE       ( MESSAGE_META_DATA_ROUTE_DESTINATION + sizeof(int) )
+#define MESSAGE_META_DATA_MINIRANK_DESTINATION  ( MESSAGE_META_DATA_MINIRANK_SOURCE + sizeof(int) )
+#define MESSAGE_META_DATA_CHECKSUM	 	( MESSAGE_META_DATA_MINIRANK_DESTINATION + sizeof(int))
+#define MESSAGE_META_DATA_SIZE                  ( MESSAGE_META_DATA_CHECKSUM + sizeof(uint32_t) )
+
+
+
 #include <RayPlatform/core/types.h>
 
 #include <stdint.h>
 
 /**
- * In Ray, every message is a Message.
- * the inbox and the outbox are arrays of Message's
- * All the code in Ray utilise Message to communicate information.
- * MPI_Datatype is always MPI_UNSIGNED_LONG_LONG
- * m_count is >=0 and <= MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(uint64_t)
- *  (default is 4000/8 = 500 ).
- *
- * in the buffer:
- *
- *  Application payload (works)
- *  int source actor (works)
- *  int destination actor (works)
- *  int routing source (works)
- *  int routing destination (works)
- *  int checksum (probably broken)
- *
+* In Ray, every message is a Message.
+* the inbox and the outbox are arrays of Message's
+* All the code in Ray utilise Message to communicate information.
+* MPI_Datatype is always MPI_UNSIGNED_LONG_LONG
+* m_count is >=0 and <= MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(uint64_t)
+*  (default is 4000/8 = 500 ).
+*
+* in the buffer:
+*
+*  Application payload (works)
+*  int source actor (works)
+*  int destination actor (works)
+*  int routing source (works)
+*  int routing destination (works)
+*  int checksum (probably broken)
+*
  * The offset (see Message.cpp) are relative to the number of bytes *BEFORE*
  * adding this metadata.
  * Note that the m_count is the number of MessageUnit for the message
@@ -106,6 +117,9 @@ private:
  * 	Must be >=0 and <= MPI_Comm_size()-1 */
 	Rank m_source;
 
+	int m_miniRankSource;
+	int m_miniRankDestination;
+
 	int m_sourceActor;
 	int m_destinationActor;
 
@@ -113,10 +127,25 @@ private:
 	int m_routingDestination;
 
 	void initialize();
+
+	void loadActorMetaData();
+	void saveActorMetaData();
+	void loadMiniRankMetaData();
+	void saveMiniRankMetaData();
+	void loadRoutingMetaData();
+	void saveRoutingMetaData();
+
 public:
 	Message();
 	~Message();
-	Message(MessageUnit * b,int c,Rank dest,MessageTag tag,Rank source);
+
+	/**
+	 * numberOf8Bytes is there for historical reasons.
+	 * You can call setNumberOfBytes afterward to set the number of bytes anyway.
+	 *
+	 */
+	Message(void* buffer, int numberOf8Bytes, Rank destination, MessageTag tag,
+			Rank source);
 	MessageUnit *getBuffer();
 	char * getBufferBytes();
 	int getCount() const;
@@ -151,26 +180,32 @@ public:
 	// actor model endpoints
 
 
-	bool isActorModelMessage() const;
+	bool isActorModelMessage(int ranks) const;
 
 	int getDestinationActor() const;
 	int getSourceActor() const;
 	void setSourceActor(int sourceActor);
 	void setDestinationActor(int destinationActor);
-	void saveActorMetaData();
-	void loadActorMetaData();
+
 	int getMetaDataSize() const;
 	void printActorMetaData();
 
 	void setRoutingSource(int source);
 	void setRoutingDestination(int destination);
-	void saveRoutingMetaData();
 
 	int getRoutingSource() const;
 	int getRoutingDestination() const;
-	void loadRoutingMetaData();
 	void displayMetaData();
 
+	void runAssertions(int size, bool routing, bool miniRanks);
+
+	void saveMetaData();
+	void loadMetaData();
+
+	void setMiniRanks(int source, int destination);
+	int getDestinationMiniRank();
+	int getSourceMiniRank();
+	void printBuffer(const char * buffer, int bytes) const;
 };
 
 #endif
diff --git a/RayPlatform/RayPlatform/communication/MessageQueue.cpp b/RayPlatform/RayPlatform/communication/MessageQueue.cpp
index 5d4da08..ba72cba 100644
--- a/RayPlatform/RayPlatform/communication/MessageQueue.cpp
+++ b/RayPlatform/RayPlatform/communication/MessageQueue.cpp
@@ -24,7 +24,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif /* ASSERT */
 
@@ -45,7 +45,7 @@ using namespace std;
 
 void MessageQueue::constructor(uint32_t bins){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bins);
 	assert(bins>0);
 	#endif /* ASSERT */
@@ -61,7 +61,7 @@ void MessageQueue::constructor(uint32_t bins){
 
 	m_dead=false;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ring!=NULL);
 	assert(m_headForPopOperations<m_size);
 	assert(m_tailForPushOperations<m_size);
@@ -151,7 +151,7 @@ void MessageQueue::destructor(){
 	if(m_size==0)
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_size>0);
 	assert(m_ring!=NULL);
 	#endif /* ASSERT */
@@ -162,7 +162,7 @@ void MessageQueue::destructor(){
 	__Free(m_ring,"/MessageQueue",false);
 	m_ring=NULL;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_size==0);
 	assert(m_ring==NULL);
 	#endif /* ASSERT */
@@ -223,7 +223,7 @@ void MessageQueue::sendKillSignal(){
 
 uint32_t MessageQueue::increment(uint32_t index){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(index<m_size);
 	assert(m_size!=0);
 	assert(index>=0);
diff --git a/RayPlatform/RayPlatform/communication/MessageRouter.cpp b/RayPlatform/RayPlatform/communication/MessageRouter.cpp
index 9576b48..1026bbf 100644
--- a/RayPlatform/RayPlatform/communication/MessageRouter.cpp
+++ b/RayPlatform/RayPlatform/communication/MessageRouter.cpp
@@ -108,51 +108,35 @@ void MessageRouter::routeOutcomingMessages(){
 		MessageTag routingTag=getRoutingTag(communicationTag);
 		aMessage->setTag(routingTag);
 
-		MessageUnit*buffer=aMessage->getBuffer();
-
-		// we need space for routing information
-		// also, if this is a control message sent to all, we need
-		// to allocate new buffers.
-		// There is no problem at rewritting buffers that have non-null buffers,
-		// but it is useless if the buffer is used once.
-		// So numberOfMessages==m_size is just an optimization.
-		if(aMessage->getBuffer()==NULL||numberOfMessages==m_size){
-
-			#ifdef ASSERT
-			assert(aMessage->getCount()==0||numberOfMessages==m_size);
-			#endif
-
-			buffer=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
-
-			#ifdef ASSERT
-			assert(buffer!=NULL);
-			#endif
-
-			// copy the old stuff too
-			if(aMessage->getBuffer()!=NULL)
-				memcpy(buffer,aMessage->getBuffer(),aMessage->getCount()*sizeof(MessageUnit));
-
-			aMessage->setBuffer(buffer);
-		}
 
 		// routing information is stored in 64 bits
-		int newCount=aMessage->getCount();
+		// avoid touching this because getCount return the number of MessageUnit whereas
+		// getNumberOfBytes returns bytes. If there are 4 bytes, getCount returns 0 and
+		// setCount will obviously erase the 4 bytes in the count.
+		//
+		// MessageUnit is there fore backward compatibility with old Ray code.
+		//
+		// New code that uses the actor model should use  setNumberOfBytes,
+		// setBuffer, and setTag.
+		// source and destination are set by the send command (plugin method)
+		/* int newCount=aMessage->getCount();
 		aMessage->setCount(newCount);
+		*/
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
+		MessageUnit*buffer=aMessage->getBuffer();
 		assert(buffer!=NULL);
 		#endif
 
 		aMessage->setRoutingSource(trueSource);
 		aMessage->setRoutingDestination(trueDestination);
-		aMessage->saveRoutingMetaData();
 
 		/*
 		setSourceInBuffer(buffer,newCount,trueSource);
 		setDestinationInBuffer(buffer,newCount,trueDestination);
 		*/
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(aMessage->getRoutingSource() ==trueSource);
 		assert(aMessage->getRoutingDestination() ==trueDestination);
 		assert(trueSource >= 0);
@@ -179,7 +163,7 @@ void MessageRouter::routeOutcomingMessages(){
 	}
 
 	// check that all messages are routable
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	for(int i=0;i<numberOfMessages;i++){
 		Message*aMessage=m_outbox->at(i);
 		if(!m_graph.isConnected(aMessage->getSource(),aMessage->getDestination()))
@@ -194,6 +178,7 @@ void MessageRouter::routeOutcomingMessages(){
  * \returns true if rerouted something.
  */
 bool MessageRouter::routeIncomingMessages(){
+
 	int numberOfMessages=m_inbox->size();
 
 	#ifdef CONFIG_ROUTING_VERBOSITY
@@ -227,7 +212,6 @@ bool MessageRouter::routeIncomingMessages(){
 
 	// at this point, we know there is a routing activity to perform.
 	//MessageUnit*buffer=aMessage->getBuffer();
-	aMessage->loadRoutingMetaData();
 
 	#ifdef CONFIG_ROUTING_VERBOSITY
 	int count=aMessage->getCount();
@@ -244,6 +228,11 @@ bool MessageRouter::routeIncomingMessages(){
 	Rank trueSource = aMessage->getRoutingSource();
 	Rank trueDestination = aMessage->getRoutingDestination();
 
+#ifdef CONFIG_ASSERT
+	assert(trueSource >= 0);
+	assert(trueDestination >= 0);
+#endif
+
 	//cout << "DEBUG after loading metadata: trueDestination= ";
 	//cout << trueDestination << " trueSource " << trueSource << endl;
 
@@ -259,7 +248,7 @@ bool MessageRouter::routeIncomingMessages(){
 		aMessage->setSource(trueSource);
 
 		// the original destination is already OK
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(aMessage->getDestination()==m_rank);
 		#endif
 
@@ -271,26 +260,30 @@ bool MessageRouter::routeIncomingMessages(){
 		#endif
 
 		// remove the routing stuff
-		int newCount=aMessage->getCount();
+		//int newCount=aMessage->getCount();
 
-		#ifdef ASSERT
-		assert(newCount>=0);
+		#ifdef CONFIG_ASSERT
+		//assert(newCount>=0);
 		#endif
 
-		aMessage->setCount(newCount);
+		//aMessage->setCount(newCount);
 
 		// set the buffer to NULL if there is no data
-		if(newCount==0)
-			aMessage->setBuffer(NULL);
+		//if(newCount==0)
+			//aMessage->setBuffer(NULL);
 
 		return false;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_rank!=trueDestination);
 	#endif
 
 #ifdef CONFIG_ASSERT
+	if(!((trueDestination >= 0 && trueDestination < m_size))) {
+		cout << "Error trueDestination " << trueDestination << endl;
+	}
+
 	assert(trueDestination >= 0 && trueDestination < m_size);
 	assert(trueSource >= 0 && trueSource < m_size);
 	assert(m_rank >= 0 && m_rank < m_size);
@@ -326,17 +319,18 @@ bool MessageRouter::routeIncomingMessages(){
  */
 void MessageRouter::relayMessage(Message*message,Rank destination){
 
-	int count=message->getCount();
+	int count=message->getNumberOfBytes();
 
 	// routed messages always have a payload
-	#ifdef ASSERT
-	assert(count>=1);
+	// but the metadata is saved later.
+	#ifdef CONFIG_ASSERT
+	assert(count>=0);
 	#endif
 
 	MessageUnit*outgoingMessage=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 
 	// copy the data into the new buffer
-	memcpy(outgoingMessage,message->getBuffer(),count*sizeof(MessageUnit));
+	memcpy(outgoingMessage, message->getBuffer(), count*sizeof(char));
 	message->setBuffer(outgoingMessage);
 
 	#ifdef CONFIG_ROUTING_VERBOSITY
@@ -349,13 +343,12 @@ void MessageRouter::relayMessage(Message*message,Rank destination){
 	message->setSource(m_rank);
 	message->setDestination(destination);
 
-	// package routing metadata for the delivery onto the network !!!
-	message->saveRoutingMetaData();
-
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_graph.isConnected(m_rank,destination));
 	#endif
 
+	// since we used the old message to create this new one,
+	// all the metadata should still be there.
 	m_outbox->push_back(message);
 }
 
@@ -416,7 +409,7 @@ bool MessageRouter::hasCompletedRelayEvents(){
  * just add a magic number
  */
 MessageTag MessageRouter::getRoutingTag(MessageTag tag){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(tag>=0);
 	assert(tag<32768);
 	#endif
@@ -434,14 +427,14 @@ bool MessageRouter::isRoutingTag(MessageTag tag){
 
 MessageTag MessageRouter::getMessageTagFromRoutingTag(MessageTag tag){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(isRoutingTag(tag));
 	assert(tag>=__ROUTING_TAG_BASE);
 	#endif
 
 	tag-=__ROUTING_TAG_BASE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(tag>=0);
 	#endif
 
@@ -449,7 +442,7 @@ MessageTag MessageRouter::getMessageTagFromRoutingTag(MessageTag tag){
 }
 
 Rank MessageRouter::getSourceFromBuffer(MessageUnit*buffer,int count){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>=1);
 	assert(buffer!=NULL);
 	#endif
@@ -458,7 +451,7 @@ Rank MessageRouter::getSourceFromBuffer(MessageUnit*buffer,int count){
 
 	Rank rank=routingInformation[__ROUTING_SOURCE];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(rank>=0);
 	assert(rank<m_size);
 	#endif
@@ -468,7 +461,7 @@ Rank MessageRouter::getSourceFromBuffer(MessageUnit*buffer,int count){
 
 Rank MessageRouter::getDestinationFromBuffer(MessageUnit*buffer,int count){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>=1);
 	assert(buffer!=NULL);
 	#endif
@@ -491,7 +484,7 @@ Rank MessageRouter::getDestinationFromBuffer(MessageUnit*buffer,int count){
 	}
 	*/
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(rank>=0);
 	assert(rank<m_size);
 	#endif
@@ -505,7 +498,7 @@ void MessageRouter::setSourceInBuffer(MessageUnit*buffer,int count,Rank source){
 	cout<<"[setSourceInBuffer] buffer="<<buffer<<" source="<<source<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>=1);
 	assert(buffer!=NULL);
 	assert(source>=0);
@@ -523,7 +516,7 @@ void MessageRouter::setDestinationInBuffer(MessageUnit*buffer,int count,Rank des
 	cout<<"[setDestinationInBuffer] buffer="<<buffer<<" destination="<<destination<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>=1);
 	assert(buffer!=NULL);
 	assert(destination>=0);
diff --git a/RayPlatform/RayPlatform/communication/MessagesHandler.cpp b/RayPlatform/RayPlatform/communication/MessagesHandler.cpp
index fb9a403..6a0e792 100644
--- a/RayPlatform/RayPlatform/communication/MessagesHandler.cpp
+++ b/RayPlatform/RayPlatform/communication/MessagesHandler.cpp
@@ -19,6 +19,8 @@
 
 */
 
+//#define GITHUB_ISSUE_220
+
 #include "MessagesHandler.h"
 #include "MessageRouter.h"
 
@@ -42,10 +44,23 @@ using namespace std;
 
 #ifdef CONFIG_MINI_RANKS
 
+MessagesHandler::MessagesHandler() {
+
+	m_staticBuffer = NULL;
+}
+
+MessagesHandler::~MessagesHandler() {
+
+	if(m_staticBuffer != NULL) {
+		free(m_staticBuffer);
+		m_staticBuffer = NULL;
+	}
+}
+
 /**
  *
  */
-void MessagesHandler::sendAndReceiveMessagesForRankProcess(ComputeCore**cores,int miniRanksPerRank,bool*communicate){
+void MessagesHandler::sendAndReceiveMessagesForRankProcess(ComputeCore**cores,int miniRanksPerRank,bool*communicate) {
 
 	int deadMiniRanks=0;
 
@@ -131,8 +146,15 @@ void MessagesHandler::sendAndReceiveMessagesForRankProcess(ComputeCore**cores,in
  * Since all mini-ranks died, it is no longer necessasry to do
  * the communication.
  */
-	if(deadMiniRanks==miniRanksPerRank)
+	if(deadMiniRanks==miniRanksPerRank) {
+
+		/*
+		cout << "DEBUG deadMiniRanks " << deadMiniRanks;
+		cout << " miniRanksPerRank " << miniRanksPerRank << endl;
+		*/
+
 		(*communicate)=false;
+	}
 }
 
 #endif
@@ -169,7 +191,7 @@ void MessagesHandler::sendMessagesForMiniRank(MessageQueue*outbox,RingAllocator*
 		outbox->pop(aMessage);
 
 		int miniRankDestination=aMessage->getDestination();
-		int miniRankSource=aMessage->getSource();
+		//int miniRankSource=aMessage->getSource();
 
 		Rank destination=miniRankDestination/miniRanksPerRank;
 
@@ -177,17 +199,26 @@ void MessagesHandler::sendMessagesForMiniRank(MessageQueue*outbox,RingAllocator*
 		Rank source=miniRankSource/miniRanksPerRank;
 		#endif
 
-		void*buffer=aMessage->getBuffer();
-		int count=aMessage->getCount();
+		char * buffer=aMessage->getBufferBytes();
+		int bytes = aMessage->getNumberOfBytes();
 		MessageTag tag=aMessage->getTag();
 
-		#ifdef ASSERT
+#ifdef GITHUB_ISSUE_220
+		if(tag == 17) {
+
+			cout << "DEBUG buffer for message in buffered outbox" << endl;
+			Message dummy2;
+			dummy2.printBuffer(buffer, bytes);
+		}
+#endif
+
+		#ifdef CONFIG_ASSERT
 		assert(destination>=0);
 		if(destination>=m_size){
 			cout<<"Tag="<<tag<<" Destination="<<destination<<endl;
 		}
 		assert(destination<m_size);
-		assert(!(buffer==NULL && count>0));
+		assert(!(buffer==NULL && bytes >0));
 
 		// this assertion is invalid when using checksum calculation.
 		//assert(count<=(int)(MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit)));
@@ -198,15 +229,20 @@ void MessagesHandler::sendMessagesForMiniRank(MessageQueue*outbox,RingAllocator*
  * by using the original buffer directly.
  * But it is not possible because it is not thread-safe to do so.
  */
-		MessageUnit*theBuffer=(MessageUnit*)outboxBufferAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
-		memcpy(theBuffer,buffer,count*sizeof(MessageUnit));
+		char * copiedBuffer=(char*)outboxBufferAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+		memcpy(copiedBuffer, buffer, bytes);
+
+#ifdef GITHUB_ISSUE_220
+		if(tag == 17) {
+			cout << "DEBUG Copying " << bytes << " bytes for tag=17" << endl;
+			Message dummy;
+			dummy.printBuffer(copiedBuffer, bytes);
+		}
+#endif
 
 /*
  * Store minirank information too at the end.
  */
-		theBuffer[count++]=miniRankSource;
-		theBuffer[count++]=miniRankDestination;
-
 		#ifdef CONFIG_DEBUG_MINI_RANK_COMMUNICATION
 		cout<<"SEND Source= "<<miniRankSource<<" Destination= "<<miniRankDestination<<" Tag= "<<tag<<endl;
 		#endif /* CONFIG_DEBUG_MINI_RANK_COMMUNICATION */
@@ -218,27 +254,46 @@ void MessagesHandler::sendMessagesForMiniRank(MessageQueue*outbox,RingAllocator*
 /*
  * Check if the buffer is already registered.
  */
-		int bufferHandle=outboxBufferAllocator->getBufferHandle(theBuffer);
+		int bufferHandle=outboxBufferAllocator->getBufferHandle(copiedBuffer);
 		bool registeredAlready=outboxBufferAllocator->isRegistered(bufferHandle);
+
 /*
  * Register the buffer as being dirty.
  */
 
 		if(!registeredAlready) {
 
-			request = this->registerMessageBuffer(buffer, m_rank, destination,
+#ifdef CONFIG_ASSERT
+			int handle = outboxBufferAllocator->getBufferHandle(copiedBuffer);
+			assert(handle >= 0);
+#endif
+
+			request = this->registerMessageBuffer(copiedBuffer, m_rank, destination,
 					tag, outboxBufferAllocator);
 
+			registeredAlready = true;
+
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(request!=NULL);
-		assert(count>=2);
+		assert(bytes >=2);
 		#endif
 
 		//  MPI_Isend
 		//      Synchronous nonblocking. 
-		MPI_Isend(theBuffer,count,m_datatype,destination,tag,MPI_COMM_WORLD,request);
+
+		int count = bytes;
+
+#ifdef GITHUB_ISSUE_220
+		if(tag == 17) {
+			cout << "DEBUG MPI_Isend " << count << " bytes to " << destination << endl;
+			Message dummy;
+			dummy.printBuffer(copiedBuffer, count);
+		}
+#endif
+
+		MPI_Isend(copiedBuffer,count,m_datatype,destination,tag,MPI_COMM_WORLD,request);
 
 		#if 0
 		// if the message was re-routed, we don't care
@@ -262,7 +317,7 @@ void MessagesHandler::sendMessagesForMiniRank(MessageQueue*outbox,RingAllocator*
 
 #ifdef CONFIG_COMM_PERSISTENT
 
-/*	
+/*
  * receiveMessages is implemented as recommanded by Mr. George Bosilca from
 the University of Tennessee (via the Open-MPI mailing list)
 
@@ -307,7 +362,7 @@ void MessagesHandler::pumpMessageFromPersistentRing(StaticVector*inbox,RingAlloc
 
 		// the request can start again
 		MPI_Start(m_ring+m_head);
-	
+
 		// add the message in the internal inbox
 		// this inbox is not the real inbox
 		Message aMessage(incoming,count,m_rank,tag,source);
@@ -356,25 +411,53 @@ void MessagesHandler::receiveMessagesForMiniRanks(ComputeCore**cores,int miniRan
 	int count=-1;
 	MPI_Get_count(&status,datatype,&count);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count >= 0);
 	assert(count >= 2);// we need mini-rank numbers !
 	#endif
 
+	if(m_staticBuffer == NULL) {
+
+		int requiredBytes = MAXIMUM_MESSAGE_SIZE_IN_BYTES + MESSAGE_META_DATA_SIZE;
+		m_staticBuffer = (char*) malloc(requiredBytes);
+
+#ifdef CONFIG_ASSERT
+		assert(m_staticBuffer != NULL);
+#endif
+	}
 
 	MPI_Recv(m_staticBuffer,count,datatype,actualSource,actualTag,MPI_COMM_WORLD,&status);
 
+#ifdef GITHUB_ISSUE_220
+	if(actualTag == 17) {
+		cout << "DEBUG MPI_Recv from " << actualSource << " with " << count;
+		cout << " bytes." << endl;
+
+		Message dummy;
+		dummy.printBuffer(m_staticBuffer, count);
+	}
+#endif
+
+
+	//cout << "DEBUG preloading metadata count= " << count << endl;
+
+	Message newMessage(m_staticBuffer, count, -1, actualTag, -1); // here the count is the number of MessageUnit
+	newMessage.setNumberOfBytes(count);
+
+	newMessage.loadMetaData();
+	newMessage.saveMetaData(); // ComputeCore will re-load it anyway
+
 /*
  * Get the mini-rank source and mini-rank destination.
+ * using a temporary message
  */
-	int miniRankSource=m_staticBuffer[count-2];
-	int miniRankDestination=m_staticBuffer[count-1];
+	int miniRankSource = newMessage.getSourceMiniRank();
+	int miniRankDestination = newMessage.getDestinationMiniRank();
 
 	#ifdef CONFIG_DEBUG_MINI_RANK_COMMUNICATION
 	cout<<"RECEIVE Source= "<<miniRankSource<<" Destination= "<<miniRankDestination<<" Tag= "<<actualTag<<endl;
 	#endif /* CONFIG_DEBUG_MINI_RANK_COMMUNICATION */
 
-	count-=2;
 
 	int miniRankIndex=miniRankDestination%miniRanksPerRank;
 
@@ -383,7 +466,7 @@ void MessagesHandler::receiveMessagesForMiniRanks(ComputeCore**cores,int miniRan
 	cout<<" tag is "<<actualTag<<endl;
 	#endif
 
-	MessageUnit*incoming=NULL;
+	char * incoming=NULL;
 
 	ComputeCore*core=cores[miniRankIndex];
 
@@ -409,16 +492,29 @@ void MessagesHandler::receiveMessagesForMiniRanks(ComputeCore**cores,int miniRan
 #endif /* CONFIG_USE_LOCKING */
 
 	if(count > 0){
-		incoming=(MessageUnit*)core->getBufferedInboxAllocator()->allocate(count*sizeof(MessageUnit));
+		incoming=(char*)core->getBufferedInboxAllocator()->allocate(count*sizeof(char));
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(incoming!=NULL);
 		#endif
 
-		memcpy(incoming,m_staticBuffer,count*sizeof(MessageUnit));
+		memcpy(incoming, m_staticBuffer,count*sizeof(char));
+
+#ifdef GITHUB_ISSUE_220
+		if(actualTag == 17) {
+			cout << "DEBUG copying " << count << " bytes to incoming buffer";
+			cout << endl;
+
+			Message dummy;
+			dummy.printBuffer(incoming, count);
+		}
+#endif
+
+
 	}
 
-	Message aMessage(incoming,count,miniRankDestination,actualTag,miniRankSource);
+	Message aMessage(incoming, count, miniRankDestination, actualTag, miniRankSource);
+	aMessage.setNumberOfBytes(count);
 
 /*
  * Try to push the message. If it does not work, just try again.
@@ -438,13 +534,12 @@ void MessagesHandler::receiveMessagesForMiniRanks(ComputeCore**cores,int miniRan
 	inbox->unlock();
 #endif /* CONFIG_USE_LOCKING */
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	// this assertion is not valid for mini-ranks.
 	//assert(aMessage.getDestination() == m_rank);
 	#endif
 
 	m_receivedMessages++;
-
 }
 
 #endif
@@ -463,8 +558,8 @@ void MessagesHandler::receiveMessagesForMiniRanks(ComputeCore**cores,int miniRan
  * Starts a non-blocking reception
  */
 void MessagesHandler::startNonBlockingReception(int handle){
-	
-	#ifdef ASSERT
+
+	#ifdef CONFIG_ASSERT
 	assert(handle<m_numberOfNonBlockingReceives);
 	assert(handle>=0);
 	#endif /* ASSERT */
@@ -473,7 +568,7 @@ void MessagesHandler::startNonBlockingReception(int handle){
 
 	MPI_Request*request=m_requests+handle;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(buffer!=NULL);
 	assert(request!=NULL);
 	#endif /* ASSERT */
@@ -491,8 +586,8 @@ void MessagesHandler::init_irecv_testany(RingAllocator*inboxAllocator){
 		"CONFIG_COMM_IRECV_TESTANY",false);
 	m_receptionBuffers=(uint8_t*)__Malloc(m_bufferSize*m_numberOfNonBlockingReceives,
 		"CONFIG_COMM_IRECV_TESTANY",false);
-	
-	#ifdef ASSERT
+
+	#ifdef CONFIG_ASSERT
 	assert(m_requests!=NULL);
 	#endif
 
@@ -526,14 +621,14 @@ void MessagesHandler::receiveMessages_irecv_testany(StaticVector*inbox,RingAlloc
 	int hasCompleted=0;
 	MPI_Status status;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int returnValue=
 	#endif /* ASSERT */
 
 	MPI_Testany(m_numberOfNonBlockingReceives,m_requests,
 		&indexOfCompletedRequest,&hasCompleted,&status);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(returnValue==MPI_SUCCESS);
 	#endif /* ASSERT */
 
@@ -548,7 +643,7 @@ void MessagesHandler::receiveMessages_irecv_testany(StaticVector*inbox,RingAlloc
 
 	uint8_t*populatedBuffer=m_receptionBuffers+indexOfCompletedRequest*m_bufferSize;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count >= 0);
 	#endif
 
@@ -561,7 +656,7 @@ void MessagesHandler::receiveMessages_irecv_testany(StaticVector*inbox,RingAlloc
 	Message aMessage(incoming,count,m_rank,actualTag,actualSource);
 	inbox->push_back(aMessage);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(aMessage.getDestination() == m_rank);
 	#endif
 
@@ -652,11 +747,11 @@ void MessagesHandler::probeAndRead(Rank source,MessageTag tag,
 	int count=-1;
 	MPI_Get_count(&status,datatype,&count);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count >= 0);
 	#endif
 
-	MessageUnit staticBuffer[MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit)+2];
+	char staticBuffer[MAXIMUM_MESSAGE_SIZE_IN_BYTES + MESSAGE_META_DATA_SIZE];
 
 	MPI_Recv(staticBuffer,count,datatype,actualSource,actualTag,MPI_COMM_WORLD,&status);
 
@@ -694,7 +789,7 @@ void MessagesHandler::probeAndRead(Rank source,MessageTag tag,
 
 	core->getInbox()->push_back(&aMessage);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	// this assertion is not valid for mini-ranks.
 	//assert(aMessage.getDestination() == m_rank);
 	#endif
@@ -758,7 +853,7 @@ void MessagesHandler::constructor(int*argc,char***argv){
 	m_datatype=MPI_BYTE;
 
 	#ifdef CONFIG_MINI_RANKS_disabled
-	
+
 	int provided;
 	MPI_Init_thread(argc,argv, MPI_THREAD_FUNNELED, &provided);
 	bool threads_ok = provided >= MPI_THREAD_FUNNELED;
@@ -775,7 +870,7 @@ void MessagesHandler::constructor(int*argc,char***argv){
 		cout<<"MPI_THREAD_MULTIPLE";
 	cout<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(threads_ok);
 	#endif
 
@@ -1014,7 +1109,7 @@ void MessagesHandler::sendMessages(StaticVector*outbox,RingAllocator*outboxBuffe
 		int count=aMessage->getNumberOfBytes();
 		MessageTag tag=aMessage->getTag();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(destination>=0);
 		if(destination>=m_size){
 			cout<<"Tag="<<tag<<" Destination="<<destination<<endl;
@@ -1048,7 +1143,7 @@ void MessagesHandler::sendMessages(StaticVector*outbox,RingAllocator*outboxBuffe
 					tag, outboxBufferAllocator);
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(request!=NULL);
 		#endif
 
@@ -1072,7 +1167,7 @@ void MessagesHandler::sendMessages(StaticVector*outbox,RingAllocator*outboxBuffe
 
 			MPI_Request_free(request);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(*request==MPI_REQUEST_NULL);
 			#endif
 		}
@@ -1101,7 +1196,7 @@ void MessagesHandler::receiveMessages(StaticVector*inbox,RingAllocator*inboxAllo
 	#ifdef COMMUNICATION_IS_VERBOSE
 	cout<<"call to probeAndRead source="<<source<<""<<endl;
 	#endif /* COMMUNICATION_IS_VERBOSE */
-	
+
 	int source=MPI_ANY_SOURCE;
 	int tag=MPI_ANY_TAG;
 
@@ -1120,13 +1215,13 @@ void MessagesHandler::receiveMessages(StaticVector*inbox,RingAllocator*inboxAllo
 	int count=-1;
 	MPI_Get_count(&status,datatype,&count);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count >= 0);
 	#endif
 
-	MessageUnit*incoming=NULL;
+	char * incoming=NULL;
 	if(count > 0){
-		incoming=(MessageUnit*)inboxAllocator->allocate(count*sizeof(MessageUnit));
+		incoming=(char*)inboxAllocator->allocate(count * sizeof(char));
 	}
 
 	MPI_Recv(incoming,count,datatype,actualSource,actualTag,MPI_COMM_WORLD,&status);
@@ -1136,7 +1231,7 @@ void MessagesHandler::receiveMessages(StaticVector*inbox,RingAllocator*inboxAllo
 
 	inbox->push_back(&aMessage);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(aMessage.getDestination() == m_rank);
 	#endif
 
@@ -1196,13 +1291,13 @@ void MessagesHandler::receiveMessagesForComputeCore(StaticVector*inbox,RingAlloc
 		Message message;
 		bufferedInbox->pop(&message);
 
-		int count=message.getCount();
-		MessageUnit*incoming=(MessageUnit*)inboxAllocator->allocate(count*sizeof(MessageUnit));
+		int count=message.getNumberOfBytes();
+		char *incoming=(char*)inboxAllocator->allocate(count*sizeof(char));
 
 /*
- * Copy the data, this is slow. 
+ * Copy the data, this is slow but required I think.
  */
-		memcpy(incoming,message.getBuffer(),count*sizeof(MessageUnit));
+		memcpy(incoming,message.getBuffer(), count*sizeof(char));
 
 /*
  * Update the buffer so that the code is thread-safe.
diff --git a/RayPlatform/RayPlatform/communication/MessagesHandler.h b/RayPlatform/RayPlatform/communication/MessagesHandler.h
index 8b252b1..f615417 100644
--- a/RayPlatform/RayPlatform/communication/MessagesHandler.h
+++ b/RayPlatform/RayPlatform/communication/MessagesHandler.h
@@ -128,7 +128,7 @@ class MessagesHandler{
  * We need a temporary buffer because we don't know yet 
  * for which mini-rank the message is for.
  */
-	MessageUnit m_staticBuffer[MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit)+2];
+	char * m_staticBuffer;
 #endif
 
 	bool m_hasReceivedMessage;
@@ -241,6 +241,10 @@ class MessagesHandler{
 		RingAllocator * outboxBufferAllocator) const;
 
 public:
+
+	MessagesHandler();
+	~MessagesHandler();
+
 /** 
  * initialize the message handler
 */
diff --git a/RayPlatform/RayPlatform/communication/VirtualCommunicator.cpp b/RayPlatform/RayPlatform/communication/VirtualCommunicator.cpp
index 11c935f..d4e21de 100644
--- a/RayPlatform/RayPlatform/communication/VirtualCommunicator.cpp
+++ b/RayPlatform/RayPlatform/communication/VirtualCommunicator.cpp
@@ -35,7 +35,7 @@ using namespace std;
 
 /** set the number of elements per message for a given tag */
 void VirtualCommunicator::setElementsPerQuery(int tag,int size){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)==0);
 	assert(tag!=INVALID_HANDLE);
 	#endif
@@ -45,7 +45,7 @@ void VirtualCommunicator::setElementsPerQuery(int tag,int size){
 
 /** get the number of elements per message for a given tag */
 int VirtualCommunicator::getElementsPerQuery(int tag){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)!=0);
 	#endif
 
@@ -54,13 +54,13 @@ int VirtualCommunicator::getElementsPerQuery(int tag){
 
 /**  associate the reply message tag to a message tag */
 void VirtualCommunicator::setReplyType(int query,int reply){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_replyTagToQueryTag.count(reply)==0);
 	#endif
 
 	m_replyTagToQueryTag[reply]=query;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_reverseReplyMap.count(query) == 0);
 	#endif
 
@@ -68,7 +68,7 @@ void VirtualCommunicator::setReplyType(int query,int reply){
 }
 
 int VirtualCommunicator::getReplyType(int tag){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_reverseReplyMap.count(tag) == 0){
 		cout<<"Error: "<<MESSAGE_TAGS[tag]<<" is not in the reverse-map"<<endl;
 	}
@@ -85,14 +85,14 @@ int VirtualCommunicator::getReplyType(int tag){
 void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
 	int tag=message->getTag();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)>0);
 	#endif
 
 	int period=m_elementSizes[tag];
 	int count=message->getCount();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(count > period){
 		cout<<"Error, count= "<<count<<" but period is "<<period<<endl;
 		cout<<"Tag= "<<MESSAGE_TAGS[tag]<<endl;
@@ -101,7 +101,7 @@ void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
 	#endif
 
 	m_pushedMessages++;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_elementsForWorkers.count(workerId)>0){
 		cout<<"Error: there is already a pending message for worker "<<workerId<<", will not add message with tag="<<MESSAGE_TAGS[message->getTag()]<<endl;
 		cout<<"Did you forget to pull a reply with isMessageProcessed and getMessageResponseElements ?"<<endl;
@@ -114,14 +114,14 @@ void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
 
 	int destination=message->getDestination();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(!(destination>=0&&destination<m_size)){
 		cout<<"Error: tag="<<message->getTag()<<" destination="<<destination<<" (INVALID)"<<endl;
 	}
 	assert(destination>=0&&destination<m_size);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)>0);
 	#endif
 
@@ -141,7 +141,7 @@ void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
 	int newPriority=oldPriority+count;
 	m_priorityQueue[newPriority].insert(elementId);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>0);
 	#endif
 
@@ -156,7 +156,7 @@ void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
  */
 	m_workerCurrentIdentifiers[tag][destination].push_back(workerId);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)>0);
 	#endif
 
@@ -169,7 +169,7 @@ void VirtualCommunicator::pushMessage(WorkerHandle workerId,Message*message){
 	int threshold=MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit)/period;
 
 	/** this whole block makes sure that the communicator is not overloaded */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elementSizes.count(tag)>0);
 	assert(period>=1);
 	assert(threshold<=(int)(MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit)));
@@ -195,7 +195,7 @@ void VirtualCommunicator::flushMessage(int tag,int destination){
 
 	m_flushedMessages++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_messageContent.count(tag)>0&&m_messageContent[tag].count(destination)>0);
 	#endif
 
@@ -211,7 +211,7 @@ void VirtualCommunicator::flushMessage(int tag,int destination){
 	m_activeTag=tag;
 	int currentSize=priority;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(currentSize==0){
 		cout<<"Cannot flush empty buffer!"<<endl;
 	}
@@ -242,7 +242,7 @@ bool VirtualCommunicator::isMessageProcessed(WorkerHandle workerId){
 }
 
 void VirtualCommunicator::getMessageResponseElements(WorkerHandle workerId,vector<MessageUnit>*out){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(isMessageProcessed(workerId));
 	#endif
 
@@ -251,7 +251,7 @@ void VirtualCommunicator::getMessageResponseElements(WorkerHandle workerId,vecto
 
 	m_elementsForWorkers.erase(workerId);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!isMessageProcessed(workerId));
 	#endif
 }
@@ -291,7 +291,7 @@ void VirtualCommunicator::processInbox(vector<WorkerHandle>*activeWorkers){
 			return;
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_replyTagToQueryTag.count(incomingTag)>0);
 		#endif
 
@@ -305,7 +305,7 @@ void VirtualCommunicator::processInbox(vector<WorkerHandle>*activeWorkers){
 			cout.flush();
 			MessageUnit*buffer=(MessageUnit*)message->getBuffer();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_elementSizes.count(queryTag)>0);
 			#endif
 
@@ -313,7 +313,7 @@ void VirtualCommunicator::processInbox(vector<WorkerHandle>*activeWorkers){
 			vector<WorkerHandle> workers=m_workerCurrentIdentifiers[m_activeTag][m_activeDestination];
 			m_workerCurrentIdentifiers[m_activeTag][m_activeDestination].clear();
 			
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(workers.size()>0);
 			assert(elementsPerWorker>0);
 			int count=message->getCount();
@@ -339,7 +339,7 @@ void VirtualCommunicator::processInbox(vector<WorkerHandle>*activeWorkers){
 
 				int basePosition=i*elementsPerWorker;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_elementsForWorkers.count(workerId)>0){
 					cout<<"there already are elements for "<<workerId<<endl;
 				}
@@ -355,14 +355,14 @@ void VirtualCommunicator::processInbox(vector<WorkerHandle>*activeWorkers){
 				// make sure that is someone 
 				// asks if workerId can fetch its thing,
 				// it will return true.
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(isMessageProcessed(workerId));
 				#endif
 			}
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pendingMessages>=0);
 	#endif
 }
@@ -406,7 +406,7 @@ void VirtualCommunicator::forceFlush(){
 	// and there are no message
 	// the thing will crash 
 	// it is designed like that
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!m_priorityQueue.rbegin()->second.empty());
 	#endif
 
@@ -414,7 +414,7 @@ void VirtualCommunicator::forceFlush(){
 	int selectedDestination=getDestinationFromMessageUniqueId(elementId);
 	int selectedTag=getTagFromMessageUniqueId(elementId);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_messageContent.count(selectedTag)>0&&m_messageContent[selectedTag].count(selectedDestination)>0);
 	assert(!m_messageContent[selectedTag][selectedDestination].empty());
 	#endif
diff --git a/RayPlatform/RayPlatform/core/ComputeCore.cpp b/RayPlatform/RayPlatform/core/ComputeCore.cpp
index 1ee947d..833b3ac 100644
--- a/RayPlatform/RayPlatform/core/ComputeCore.cpp
+++ b/RayPlatform/RayPlatform/core/ComputeCore.cpp
@@ -28,7 +28,7 @@
 
 #include <stdlib.h>
 #include <string.h> /* for strcpy */
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 #include <iostream>
@@ -69,6 +69,7 @@ void handleSignal(int signalNumber) {
 
 ComputeCore::ComputeCore(){
 
+	m_useActorModelOnly = false;
 	m_playground.initialize(this);
 
 }
@@ -89,7 +90,7 @@ void ComputeCore::setSlaveModeObjectHandler(PluginHandle plugin,SlaveMode mode,S
 	cout<<"setSlaveModeObjectHandler "<<SLAVE_MODES[mode]<<" to "<<object<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasSlaveMode(mode));
 	#endif
@@ -113,7 +114,7 @@ void ComputeCore::setMasterModeObjectHandler(PluginHandle plugin,MasterMode mode
 	cout<<"setMasterModeObjectHandler "<<MASTER_MODES[mode]<<" to "<<object<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasMasterMode(mode));
 	#endif
@@ -137,7 +138,7 @@ void ComputeCore::setMessageTagObjectHandler(PluginHandle plugin,MessageTag tag,
 	cout<<"setMessageTagObjectHandler "<<MESSAGE_TAGS[tag]<<" to "<<object<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasMessageTag(tag));
 	#endif
@@ -331,7 +332,7 @@ void ComputeCore::runWithProfiler(){
 	m_playground.bootActors();
 
 	while(isRankAlive()
-			|| (m_routerIsEnabled && !m_router.hasCompletedRelayEvents())){
+			|| (m_routerIsEnabled && !m_router.hasCompletedRelayEvents())) {
 
 		// update the debug mode.
 		// this is cheap -- it only needs to copy a boolean (usually a char)
@@ -365,6 +366,8 @@ void ComputeCore::runWithProfiler(){
 				cout << seconds * 1000 << " ms ! (tick # " << globalTicks;
 				cout << "), length is ";
 				cout << resolution << " ms" << endl;
+				m_playground.printStatus();
+				m_outboxAllocator.printBufferStatus();
 
 				status.getProcessStatus();
 				status.printMemoryMetrics();
@@ -504,7 +507,11 @@ void ComputeCore::runWithProfiler(){
 		int currentSlaveMode=m_switchMan.getSlaveMode();
 
 		uint64_t startingTime = getThreadMicroseconds();
-		processData();
+
+		if(!useActorModelOnly()) {
+			processData();
+		}
+
 		uint64_t endingTime = getThreadMicroseconds();
 
 		int difference = endingTime - startingTime;
@@ -547,23 +554,49 @@ void ComputeCore::runWithProfiler(){
 		// 4. send messages
 		sendMessages();
 
+		m_outboxAllocator.resetCount();
+
 		/* increment ticks */
 		ticks++;
 		globalTicks ++;
 	}
 
+	//cout << "DEBUG exiting ComputeCore loop" << endl;
+
+	if(m_miniRanksAreEnabled){
+#ifdef CONFIG_USE_LOCKING
+		m_bufferedOutbox.lock();
+#endif /* CONFIG_USE_LOCKING */
+
+		m_bufferedOutbox.sendKillSignal();
+
+#ifdef CONFIG_USE_LOCKING
+		m_bufferedOutbox.unlock();
+#endif /* CONFIG_USE_LOCKING */
+	}
+
+
 	if(debugModeIsEnabled() && profileGranularity)
 		m_profiler.printAllGranularities();
 }
 
 void ComputeCore::processMessages(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_inbox.size()>=0&&m_inbox.size()<=1);
 	#endif
 
 	if(m_inbox.size()==0)
 		return;
 
+	int i = 0;
+
+	Message * importantMessage = m_inbox.at(i);
+
+	// TODO: don't transport routing metadata if routing is disabled !
+	// save actor metadata
+	//
+	// load routing and acting metadata in the reverse order
+	// in which they were saved !!!
 
 	// if routing is enabled, we want to strip the routing tags if it
 	// is required
@@ -582,18 +615,12 @@ void ComputeCore::processMessages(){
 		}
 	}
 
-	// the message is for us...
-	// load actor metadata
-	for(int i = 0 ; i < (int) m_inbox.size() ; ++i) {
-		Message * message = m_inbox.at(i);
+	// dispatch the message
+	if(importantMessage->isActorModelMessage(m_size)) {
 
-		// save actor metadata
-		message->loadActorMetaData();
+		// cout << "DEBUG actor message detected ! m_size = " << m_size << endl;
 
-		// dispatch the message
-		if(message->isActorModelMessage()) {
-			m_playground.receiveActorMessage(message);
-		}
+		m_playground.receiveActorMessage(importantMessage);
 	}
 
 	if(m_inbox.size() > 0 && m_showCommunicationEvents){
@@ -608,10 +635,10 @@ void ComputeCore::processMessages(){
 
 
 
-	Message*message=m_inbox[0];
+	Message*message= importantMessage;
 	MessageTag messageTag=message->getTag();
 
-	#ifdef ASSERT2
+	#ifdef CONFIG_ASSERT2
 	assert(messageTag!=INVALID_HANDLE);
 	assert(m_allocatedMessageTags.count(messageTag)>0);
 	string symbol=MESSAGE_TAGS[messageTag];
@@ -627,35 +654,57 @@ void ComputeCore::processMessages(){
 
 void ComputeCore::sendMessages(){
 
-	// register actor meta-data
+/*
+ * Don't do anything when there are no messages
+ * at all.
+ * This statement needs to be after the ifdef CONFIG_ASSERT above
+ * otherwise the no resetCount call is performed on the
+ * allocator, which will produce a run-time error.
+ */
+	if(m_outbox.size()==0)
+		return;
+
+	int numberOfMessages = m_outbox.size();
+
+// first, allocate new a new buffer for each message.
+
+	bool forceMemoryReallocation = true;
 
 	for(int i = 0 ; i < (int) m_outbox.size() ; ++i) {
-		Message * message = m_outbox.at(i);
+		Message * aMessage = m_outbox.at(i);
 
-		// we need a buffer to store the actor metadata
-		if(message->getBuffer() == NULL) {
-			void * buffer = m_outboxAllocator.allocate(0);
-			message->setBuffer((MessageUnit*)buffer);
-		}
+		// we need space for routing information
+		// also, if this is a control message sent to all, we need
+		// to allocate new buffers.
+		// There is no problem at rewritting buffers that have non-null buffers,
+		// but it is useless if the buffer is used once.
+		// So numberOfMessages==m_size is just an optimization.
+		if(forceMemoryReallocation
+				|| ( aMessage->getBuffer()==NULL||numberOfMessages==m_size)) {
 
-		/*
-		cout << "DEBUG Before saving ";
-		message->printActorMetaData();
-		cout << endl;
-		*/
+			#ifdef CONFIG_ASSERT
+			assert(forceMemoryReallocation || aMessage->getCount()==0||numberOfMessages==m_size);
+			#endif
 
-		// save actor metadata
-		// routed message already have this
-		if(!m_router.isRoutingTag(message->getTag()))
-			message->saveActorMetaData();
+			char * buffer=(char*)m_outboxAllocator.allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 
-		/*
-		cout << "DEBUG After saving ";
-		message->printActorMetaData();
-		cout << endl;
-		*/
+			#ifdef CONFIG_ASSERT
+			assert(buffer!=NULL);
+			#endif
+
+			// copy the old stuff too
+			if(aMessage->getBuffer()!=NULL) {
+
+				memcpy(buffer, aMessage->getBuffer(), aMessage->getNumberOfBytes() * sizeof(char));
+			}
+
+			aMessage->setBuffer(buffer);
+		}
 	}
 
+
+// run some assertions.
+
 /*
  * What follows is all the crap for checking some assertions and
  * profiling events.
@@ -663,7 +712,7 @@ void ComputeCore::sendMessages(){
  * of this method.
  */
 	// assert that we did not overflow the ring
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_outboxAllocator.getCount() > m_maximumAllocatedOutboxBuffers){
 		cout<<"Rank "<<m_rank<<" Error, allocated "<<m_outboxAllocator.getCount()<<" buffers, but maximum is ";
 		cout<<m_maximumAllocatedOutboxBuffers<<endl;
@@ -673,7 +722,6 @@ void ComputeCore::sendMessages(){
 
 	assert(m_outboxAllocator.getCount()<=m_maximumAllocatedOutboxBuffers);
 
-	m_outboxAllocator.resetCount();
 	int messagesToSend=m_outbox.size();
 	if(messagesToSend>m_maximumNumberOfOutboxMessages){
 		cout<<"Fatal: "<<messagesToSend<<" messages to send, but max is "<<m_maximumNumberOfOutboxMessages<<endl;
@@ -693,15 +741,44 @@ void ComputeCore::sendMessages(){
 
 	#endif
 
-/*
- * Don't do anything when there are no messages
- * at all.
- * This statement needs to be after the ifdef ASSERT above
- * otherwise the no resetCount call is performed on the
- * allocator, which will produce a run-time error.
- */
-	if(m_outbox.size()==0)
-		return;
+///////////////////////----------------
+
+
+	// old useless code
+#ifdef OLD_ACTOR_META_CODE
+	// register actor meta-data
+
+	for(int i = 0 ; i < (int) m_outbox.size() ; ++i) {
+		Message * message = m_outbox.at(i);
+
+		// we need a buffer to store the actor metadata
+		if(message->getBuffer() == NULL) {
+			void * buffer = m_outboxAllocator.allocate(0);
+			message->setBuffer(buffer);
+		}
+
+		/*
+		cout << "DEBUG Before saving ";
+		message->printActorMetaData();
+		cout << endl;
+		*/
+
+		// save actor metadata
+		// routed message already have this
+		/*if(!m_router.isRoutingTag(message->getTag()))
+			message->saveActorMetaData();
+			*/
+
+		/*
+		cout << "DEBUG After saving ";
+		message->printActorMetaData();
+		cout << endl;
+		*/
+
+
+	}
+#endif
+
 
 	// route messages if the router is enabled
 	if(m_routerIsEnabled){
@@ -710,6 +787,33 @@ void ComputeCore::sendMessages(){
 		m_router.routeOutcomingMessages();
 	}
 
+	// save metadata
+	for(int i=0;i<(int)m_outbox.size();i++){
+
+		Message * message = m_outbox.at(i);
+
+		// TODO: only save routing metadata if routing is activated !
+		// this will save 8 bytes per transport operation
+
+		// save the minirank number because the mini-rank subsystem needs that
+
+		if(m_miniRanksAreEnabled) {
+			message->setMiniRanks(message->getSource(), message->getDestination());
+		}
+
+		message->saveMetaData();
+
+#ifdef CONFIG_ASSERT
+		testMessage(message);
+#endif
+	}
+
+	// add checksums if necessary
+	if(m_doChecksum){
+		addMessageChecksums();
+	}
+
+
 	// parameters.showCommunicationEvents()
 	if( m_showCommunicationEvents && m_outbox.size() > 0){
 		uint64_t microseconds=getMicroseconds() - m_startingTimeMicroseconds;
@@ -722,13 +826,44 @@ void ComputeCore::sendMessages(){
 
 	for(int i=0;i<(int)m_outbox.size();i++){
 		m_tickLogger.logSendMessage(INVALID_HANDLE);
+
+#ifdef GITHUB_ISSUE_220
+		Message * message = m_outbox.at(i);
+
+		if(message->getTag() == 17 && message->getDestination() == 2) {
+
+			cout << "DEBUG before sending inside mini-rank" << endl;
+			message->print();
+		}
+#endif
 	}
 
-	// add checksums if necessary
-	if(m_doChecksum){
-		addMessageChecksums();
+
+	#ifdef CONFIG_ASSERT
+
+	for(int i=0;i<(int)m_outbox.size();i++){
+
+		Message * message = m_outbox.at(i);
+
+#ifdef CONFIG_ASSERT
+		testMessage(message);
+#endif
+
+//#define INVESTIGATION_2013_11_04
+#ifdef INVESTIGATION_2013_11_04
+		if(message->getTag() == 17) {
+
+			cout << "DEBUG INVESTIGATION_2013_11_04 ";
+			cout << (void*) message->getBufferBytes();
+			cout << endl;
+		}
+#endif
+
+
 	}
 
+#endif
+
 	// finally, send the messages
 
 	if(!m_miniRanksAreEnabled){
@@ -747,24 +882,26 @@ void ComputeCore::sendMessages(){
 void ComputeCore::addMessageChecksums(){
 
 	int count=m_outbox.size();
+
 	for(int i=0;i<count;i++){
-		MessageUnit*data=m_outbox.at(i)->getBuffer();
-		int numberOfUnits=m_outbox.at(i)->getCount();
 
+		char * data=m_outbox.at(i)->getBufferBytes();
+		int numberOfBytes = m_outbox.at(i)->getNumberOfBytes();
+
+		/*
 		// don't compute checksum for empty messages
-		if(numberOfUnits==0){
+		if(bytes == 0){
 			continue;
 		}
-
-		int numberOfBytes=sizeof(MessageUnit)*numberOfUnits;
+		*/
 
 		uint8_t*bytes=(uint8_t*)data;
 
 		uint32_t crc32=computeCyclicRedundancyCode32(bytes,numberOfBytes);
 
-		data[numberOfUnits]=crc32;
+		memcpy(bytes + numberOfBytes, &crc32, sizeof(crc32));
 
-		m_outbox.at(i)->setCount(numberOfUnits+1);
+		m_outbox.at(i)->setNumberOfBytes(numberOfBytes + sizeof(crc32));
 	}
 
 }
@@ -773,28 +910,37 @@ void ComputeCore::verifyMessageChecksums(){
 
 	int count=m_inbox.size();
 	for(int i=0;i<count;i++){
-		MessageUnit*data=m_inbox.at(i)->getBuffer();
 
-		// this contains the checksum unit too.
-		int numberOfUnits=m_inbox.at(i)->getCount();
+		Message * message = m_inbox.at(i);
 
-		// don't compute checksum for empty messages
-		if(numberOfUnits==0){
-			continue;
-		}
+		uint32_t crc32 = 0;
+		char * data = message->getBufferBytes();
+
+#ifdef CONFIG_ASSERT
+		assert(message->getNumberOfBytes() >= (int) sizeof(crc32));
+#endif
+
+		message->setNumberOfBytes(message->getNumberOfBytes() - sizeof(crc32));
+
+#ifdef CONFIG_ASSERT
+		assert(message->getNumberOfBytes() >= 0);
+#endif
 
-		// the last MessageUnit contains the crc32.
-		// note that the CRC32 feature only works for MessageUnit at least
+		// the last Message Unit contains the crc32.
+		// note that the CRC32 feature only works for Message Unit at least
 		// 32 bits.
-		int numberOfBytes=sizeof(MessageUnit)*(numberOfUnits-1);
+		int numberOfBytes = m_inbox.at(i)->getNumberOfBytes();
 
 		uint8_t*bytes=(uint8_t*)data;
 
 		// compute the checksum, excluding the reference checksum
 		// from the data
-		uint32_t crc32=computeCyclicRedundancyCode32(bytes,numberOfBytes);
+		crc32 = computeCyclicRedundancyCode32((uint8_t*)bytes, numberOfBytes);
+
+		uint32_t expectedChecksum = 0;
 
-		uint32_t expectedChecksum=data[numberOfUnits-1];
+		memcpy(&expectedChecksum, data + numberOfBytes,
+			sizeof(expectedChecksum));
 
 		#ifdef CONFIG_SHOW_CHECKSUM
 		cout<<" Expected checksum (CRC32): "<<hex<<expectedChecksum<<endl;
@@ -804,25 +950,14 @@ void ComputeCore::verifyMessageChecksums(){
 		if(crc32 != expectedChecksum){
 			Message*message=m_inbox.at(i);
 			cout<<"Error: RayPlatform detected a message corruption !"<<endl;
-			cout<<" Tag: "<<MESSAGE_TAGS[message->getTag()]<<endl;
+			cout<<" Tag: " << message->getTag() << endl;
 			cout<<" Source: "<<message->getSource()<<endl;
 			cout<<" Destination: "<<message->getDestination()<<endl;
-			cout<<" sizeof(MessageUnit): "<<sizeof(MessageUnit)<<endl;
-			cout<<" Count (excluding checksum): "<<numberOfUnits-1<<endl;
+			cout<<" Bytes (excluding checksum): "<< numberOfBytes << endl;
 			cout<<" Expected checksum (CRC32): "<<hex<<expectedChecksum<<endl;
 			cout<<" Actual checksum (CRC32): "<<hex<<crc32<<dec<<endl;
 		}
 
-		#ifdef ASSERT
-		assert(numberOfUnits>=2);
-		#endif
-
-		// remove the checksum
-		m_inbox.at(i)->setCount(numberOfUnits-1);
-
-		#ifdef ASSERT
-		assert(numberOfUnits>=1);
-		#endif
 	}
 
 }
@@ -850,16 +985,42 @@ void ComputeCore::receiveMessages(){
 
 	}
 
+	if(m_inbox.size() == 0)
+		return;
+
+	// load metadata.
+
+	//cout << "DEBUG loading message metadata." << endl;
+
+	Message * importantMessage = m_inbox.at(0);
+
 	// verify checksums and remove them
+	// messages are line onions, you have to peel them from the outside to the inside
 	if(m_doChecksum){
 		verifyMessageChecksums();
 	}
 
+	importantMessage->loadMetaData();
+	importantMessage->saveMetaData();
+
+#ifdef GITHUB_ISSUE_220
+	if(importantMessage->getTag() == 17 && getRank() == 2) {
+		cout << "DEBUG ComputeCore receives message!" << endl;
+		importantMessage->print();
+	}
+#endif
+
+#ifdef CONFIG_ASSERT
+	testMessage(importantMessage);
+
+	//testMessage(importantMessage);
+#endif
+
 	for(int i=0;i<(int)m_inbox.size();i++){
 		m_tickLogger.logReceivedMessage(INVALID_HANDLE);
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int receivedMessages=m_inbox.size();
 
 	if(receivedMessages>m_maximumNumberOfInboxMessages)
@@ -868,6 +1029,8 @@ void ComputeCore::receiveMessages(){
 	assert(receivedMessages<=m_maximumNumberOfInboxMessages);
 	#endif
 
+	// remove the header now !
+	importantMessage->loadMetaData();
 }
 
 /** process data my calling current slave and master methods */
@@ -919,7 +1082,7 @@ void ComputeCore::processData(){
 void ComputeCore::constructor(int argc,char**argv,int miniRankNumber,int numberOfMiniRanks,int miniRanksPerRank,
 		MessagesHandler*messagesHandler){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(miniRankNumber<numberOfMiniRanks);
 	assert(miniRanksPerRank<=numberOfMiniRanks);
 	assert(numberOfMiniRanks>=1);
@@ -943,7 +1106,7 @@ void ComputeCore::constructor(int argc,char**argv,int miniRankNumber,int numberO
 	#endif
 
 	// checksum calculation is only tested
-	// for cases with sizeof(MessageUnit)>=4 bytes
+	// for cases with sizeof(Message Unit)>=4 bytes
 
 	m_routerIsEnabled=false;
 
@@ -1070,29 +1233,77 @@ void ComputeCore::configureEngine() {
 	cout<<"[ComputeCore] the outbox capacity is "<<m_maximumNumberOfOutboxMessages<<" message"<<endl;
 	#endif
 
-	int maximumMessageSizeInByte=MAXIMUM_MESSAGE_SIZE_IN_BYTES;
+	int maximumMessageSizeInBytes = MAXIMUM_MESSAGE_SIZE_IN_BYTES;
 
 	bool useActorModel = true;
 
 	// add a message unit to store the checksum or the routing information
-	// with 64-bit integers as MessageUnit, this is 4008 bytes or 501 MessageUnit maximum
+	// with 64-bit integers as Message Unit, this is 4008 bytes or 501 Message Unit maximum
 	// also add 8 bytes for actor metadata
+	// finally, add 4 bytes for the checksum, if necessary.
+
 	if(m_miniRanksAreEnabled || m_doChecksum || m_routerIsEnabled || useActorModel){
-		if(sizeof(MessageUnit)>=4){
-			maximumMessageSizeInByte+=(2 + 2)*sizeof(MessageUnit);
-		}else if(sizeof(MessageUnit)>=2){
-			maximumMessageSizeInByte+=(2 + 2) *2*sizeof(MessageUnit);
-		}else{
-			maximumMessageSizeInByte+=(2 + 2) *4*sizeof(MessageUnit);
+
+		int headerSize = 0;
+
+		headerSize = MESSAGE_META_DATA_SIZE;
+
+		/*
+		// actor model
+		headerSize += ( 2 * sizeof(int) * sizeof(char) );
+
+		// routing
+		headerSize += ( 2 * sizeof(int) * sizeof(char));
+
+		// checksum
+		headerSize += ( 1 * sizeof(uint32_t) * sizeof(char) );
+*/
+
+/*
+		cout << "DEBUG MAXIMUM_MESSAGE_SIZE_IN_BYTES " << MAXIMUM_MESSAGE_SIZE_IN_BYTES;
+		cout << " headerSize " << headerSize << endl;
+		*/
+
+		// align this on 8 bytes because there is still something in the code
+		// that is incorrect apparently.
+		//
+		// TODO: find why this needs to be aligned on 8 bytes. This is related to 
+		// sizeof(MessageUnit) being 8 bytes.
+		//
+		// => it is likely because of the underlying system that evolved to
+		// use 64 bits per message unit.
+
+		bool align = true;
+		//align = false;
+
+		int base = 8;
+		int remainder = headerSize % base;
+
+		if(align && remainder != 0) {
+
+			int toAdd = base - remainder;
+
+			headerSize += toAdd;
 		}
+
+		//cout << " headerSize (with padding) " << headerSize << endl;
+
+		maximumMessageSizeInBytes += headerSize;
 	}
 
+	//cout << "DEBUG maximumMessageSizeInBytes " << maximumMessageSizeInBytes << endl;
+
+#ifdef CONFIG_ASSERT
+	assert(maximumMessageSizeInBytes >= MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+	assert(maximumMessageSizeInBytes >= MAXIMUM_MESSAGE_SIZE_IN_BYTES + 20);// we need 20 bytes for storing message header
+#endif
+
 	m_inboxAllocator.constructor(m_maximumAllocatedInboxBuffers,
-		maximumMessageSizeInByte,
+		maximumMessageSizeInBytes,
 		"RAY_MALLOC_TYPE_INBOX_ALLOCATOR",false);
 
 	m_outboxAllocator.constructor(m_maximumAllocatedOutboxBuffers,
-		maximumMessageSizeInByte,
+		maximumMessageSizeInBytes,
 		"RAY_MALLOC_TYPE_OUTBOX_ALLOCATOR",false);
 
 	if(m_miniRanksAreEnabled){
@@ -1102,18 +1313,18 @@ void ComputeCore::configureEngine() {
 		#endif
 
 		m_bufferedInboxAllocator.constructor(m_maximumAllocatedOutboxBuffers,
-			maximumMessageSizeInByte,
+			maximumMessageSizeInBytes,
 			"RAY_MALLOC_TYPE_INBOX_ALLOCATOR/Buffered",false);
 
 		m_bufferedOutboxAllocator.constructor(m_maximumAllocatedOutboxBuffers,
-			maximumMessageSizeInByte,
+			maximumMessageSizeInBytes,
 			"RAY_MALLOC_TYPE_OUTBOX_ALLOCATOR/Buffered",false);
 
 	}
 
 	#ifdef CONFIG_DEBUG_CORE
-	cout<<"[ComputeCore] allocated "<<m_maximumAllocatedInboxBuffers<<" buffers of size "<<maximumMessageSizeInByte<<" for inbox messages"<<endl;
-	cout<<"[ComputeCore] allocated "<<m_maximumAllocatedOutboxBuffers<<" buffers of size "<<maximumMessageSizeInByte<<" for outbox messages"<<endl;
+	cout<<"[ComputeCore] allocated "<<m_maximumAllocatedInboxBuffers<<" buffers of size "<<maximumMessageSizeInBytes<<" for inbox messages"<<endl;
+	cout<<"[ComputeCore] allocated "<<m_maximumAllocatedOutboxBuffers<<" buffers of size "<<maximumMessageSizeInBytes<<" for outbox messages"<<endl;
 	#endif
 
 }
@@ -1291,12 +1502,12 @@ void ComputeCore::setSlaveModeSymbol(PluginHandle plugin,SlaveMode mode,const ch
 	if(!validationSlaveModeRange(plugin,mode))
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(mode>=0);
 	assert(mode<MAXIMUM_NUMBER_OF_SLAVE_HANDLERS);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasSlaveMode(mode));
 	#endif
@@ -1335,12 +1546,12 @@ void ComputeCore::setMasterModeSymbol(PluginHandle plugin,MasterMode mode,const
 	if(!validationMasterModeRange(plugin,mode))
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(mode>=0);
 	assert(mode<MAXIMUM_NUMBER_OF_MASTER_HANDLERS);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasMasterMode(mode));
 	#endif
@@ -1374,12 +1585,12 @@ void ComputeCore::setMessageTagSymbol(PluginHandle plugin,MessageTag tag,const c
 	if(!validationMessageTagRange(plugin,tag))
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(tag>=0);
 	assert(tag<MAXIMUM_NUMBER_OF_TAG_HANDLERS);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	assert(m_plugins[plugin].hasMessageTag(tag));
 	#endif
@@ -1391,6 +1602,16 @@ void ComputeCore::setMessageTagSymbol(PluginHandle plugin,MessageTag tag,const c
 	m_registeredMessageTagSymbols.insert(tag);
 
 	m_messageTagSymbols[symbol]=tag;
+
+	if(debugModeIsEnabled()) {
+
+		cout << "DEBUG----- <MessageTag><Name>";
+		cout << symbol;
+		cout << "</Name><Value>";
+		cout << tag;
+		cout << "</Value></MessageTag>";
+		cout << endl;
+	}
 }
 
 PluginHandle ComputeCore::allocatePluginHandle(){
@@ -1413,7 +1634,7 @@ SlaveMode ComputeCore::allocateSlaveModeHandle(PluginHandle plugin){
 		return INVALID_HANDLE;
 
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	#endif
 
@@ -1429,7 +1650,7 @@ SlaveMode ComputeCore::allocateSlaveModeHandle(PluginHandle plugin){
 	if(!validationSlaveModeRange(plugin,handle))
 		return INVALID_HANDLE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedSlaveModes.count(handle)==0);
 	#endif
 
@@ -1437,7 +1658,7 @@ SlaveMode ComputeCore::allocateSlaveModeHandle(PluginHandle plugin){
 
 	m_plugins[plugin].addAllocatedSlaveMode(handle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedSlaveModes.count(handle)>0);
 	assert(m_plugins[plugin].hasSlaveMode(handle));
 	#endif
@@ -1450,7 +1671,7 @@ MasterMode ComputeCore::allocateMasterModeHandle(PluginHandle plugin){
 	if(!validationPluginAllocated(plugin))
 		return INVALID_HANDLE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	#endif
 
@@ -1466,7 +1687,7 @@ MasterMode ComputeCore::allocateMasterModeHandle(PluginHandle plugin){
 	if(!validationMasterModeRange(plugin,handle))
 		return INVALID_HANDLE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedMasterModes.count(handle)==0);
 	#endif
 
@@ -1474,7 +1695,7 @@ MasterMode ComputeCore::allocateMasterModeHandle(PluginHandle plugin){
 
 	m_plugins[plugin].addAllocatedMasterMode(handle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedMasterModes.count(handle)>0);
 	assert(m_plugins[plugin].hasMasterMode(handle));
 	#endif
@@ -1487,7 +1708,7 @@ MessageTag ComputeCore::allocateMessageTagHandle(PluginHandle plugin){
 	if(!validationPluginAllocated(plugin))
 		return INVALID_HANDLE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_plugins.count(plugin)>0);
 	#endif
 
@@ -1503,7 +1724,7 @@ MessageTag ComputeCore::allocateMessageTagHandle(PluginHandle plugin){
 	if(!validationMessageTagRange(plugin,handle))
 		return INVALID_HANDLE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedMessageTags.count(handle)==0);
 	#endif
 
@@ -1511,7 +1732,7 @@ MessageTag ComputeCore::allocateMessageTagHandle(PluginHandle plugin){
 
 	m_plugins[plugin].addAllocatedMessageTag(handle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedMessageTags.count(handle)>0);
 	assert(m_plugins[plugin].hasMessageTag(handle));
 	#endif
@@ -2146,7 +2367,35 @@ bool ComputeCore::isRankAlive() const {
 	if(m_playground.hasAliveActors())
 		return true;
 
+	// if only the actor model is used, the rank is basically
+	// dead if all its actors are dead !
+	if(useActorModelOnly())
+		return false;
+
+	// otherwise, we use the life indicator for the rank
+
 	return m_alive;
 }
 
+bool ComputeCore::useActorModelOnly() const {
+
+	return m_useActorModelOnly;
+}
+
+void ComputeCore::setActorModelOnly() {
+
+	m_useActorModelOnly = true;
+}
 
+void ComputeCore::spawn(Actor * actor) {
+
+	spawnActor( actor );
+}
+
+#ifdef CONFIG_ASSERT
+void ComputeCore::testMessage(Message * message) {
+
+	message->runAssertions(getSize(), m_routerIsEnabled,
+			m_miniRanksAreEnabled);
+}
+#endif
diff --git a/RayPlatform/RayPlatform/core/ComputeCore.h b/RayPlatform/RayPlatform/core/ComputeCore.h
index 95ef58d..0183de4 100644
--- a/RayPlatform/RayPlatform/core/ComputeCore.h
+++ b/RayPlatform/RayPlatform/core/ComputeCore.h
@@ -77,6 +77,7 @@ class ComputeCore{
 	//time_t m_lastTerminalProbeOperation;
 
 	Playground m_playground;
+	bool m_useActorModelOnly;
 
 	KeyValueStore m_keyValueStore;
 
@@ -249,6 +250,13 @@ class ComputeCore{
 
 	bool isRankAlive() const;
 
+	void spawnActor(Actor * actor);
+
+#ifdef CONFIG_ASSERT
+
+	void testMessage(Message * message);
+#endif
+
 public:
 	/** this is the main method */
 	void run();
@@ -414,8 +422,11 @@ Not all master modes have yet been ported to that list.
 	bool debugModeIsEnabled();
 
 	Playground * getPlayground();
-	void spawnActor(Actor * actor);
 	void send(Message * message);
+	void spawn(Actor * actor);
+
+	void setActorModelOnly();
+	bool useActorModelOnly() const ;
 };
 
 #endif
diff --git a/RayPlatform/RayPlatform/core/OperatingSystem.cpp b/RayPlatform/RayPlatform/core/OperatingSystem.cpp
index b94215f..f3e9d9f 100644
--- a/RayPlatform/RayPlatform/core/OperatingSystem.cpp
+++ b/RayPlatform/RayPlatform/core/OperatingSystem.cpp
@@ -274,13 +274,13 @@ void createDirectory(const char*directory){
  *     */
 	mode_t mode=S_IRWXU | S_IRWXG;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int status=
 	#endif
 
 	mkdir(directory,mode);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(status!=0){
 		cout<<"mkdir returned status "<<status<<" with directory= "<<directory<<endl;
 	}
diff --git a/RayPlatform/RayPlatform/core/RankProcess.h b/RayPlatform/RayPlatform/core/RankProcess.h
index 210acf8..aa9f2f9 100644
--- a/RayPlatform/RayPlatform/core/RankProcess.h
+++ b/RayPlatform/RayPlatform/core/RankProcess.h
@@ -35,7 +35,7 @@ using namespace std;
 #ifdef CONFIG_DEBUG_MPI_RANK
 #endif /* CONFIG_DEBUG_MPI_RANK */
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif /* ASSERT */
 
@@ -187,7 +187,7 @@ void RankProcess<Application>::addMiniRank(MiniRank*miniRank){
 	cout<<"Adding mini-rank"<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfInstalledMiniRanks<m_numberOfMiniRanksPerRank);
 	#endif
 
@@ -196,7 +196,7 @@ void RankProcess<Application>::addMiniRank(MiniRank*miniRank){
 
 	m_numberOfInstalledMiniRanks++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfInstalledMiniRanks<=m_numberOfMiniRanksPerRank);
 	#endif
 
@@ -213,7 +213,7 @@ void*Rank_startMiniRank(void*object){
 template<class Application>
 void RankProcess<Application>::run(){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_numberOfMiniRanksPerRank!=m_numberOfInstalledMiniRanks){
 		cout<<"Error: "<<m_numberOfInstalledMiniRanks<<" installed mini-ranks, but need "<<m_numberOfMiniRanksPerRank<<endl;
 	}
@@ -221,7 +221,7 @@ void RankProcess<Application>::run(){
 	assert(m_numberOfMiniRanksPerRank==m_numberOfInstalledMiniRanks);
 	#endif
 
-	bool useMiniRanks=m_numberOfMiniRanksPerRank>1;
+	bool useMiniRanks=m_numberOfMiniRanksPerRank > 1;
 
 #ifndef CONFIG_MINI_RANKS
 	useMiniRanks = false;
diff --git a/RayPlatform/RayPlatform/cryptography/crypto.cpp b/RayPlatform/RayPlatform/cryptography/crypto.cpp
index 54ec5d8..16eb211 100644
--- a/RayPlatform/RayPlatform/cryptography/crypto.cpp
+++ b/RayPlatform/RayPlatform/cryptography/crypto.cpp
@@ -24,7 +24,7 @@
 #include "crypto.h"
 
 #include <string.h>
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -174,7 +174,7 @@ uint32_t computeCyclicRedundancyCode32(uint8_t*bytes,uint32_t numberOfBytes){
 
 		uint8_t position=(byte ^ checksum) & 0xff;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(position>=0);
 		assert(position<256);
 		#endif
diff --git a/RayPlatform/RayPlatform/files/FileReader.cpp b/RayPlatform/RayPlatform/files/FileReader.cpp
index 055189f..5428f30 100644
--- a/RayPlatform/RayPlatform/files/FileReader.cpp
+++ b/RayPlatform/RayPlatform/files/FileReader.cpp
@@ -177,3 +177,7 @@ bool FileReader::eof() {
 	//return m_reader.eof();
 }
 
+bool FileReader::isValid() {
+
+	return m_reader.good();
+}
diff --git a/RayPlatform/RayPlatform/files/FileReader.h b/RayPlatform/RayPlatform/files/FileReader.h
index 1a668cc..d6643ed 100644
--- a/RayPlatform/RayPlatform/files/FileReader.h
+++ b/RayPlatform/RayPlatform/files/FileReader.h
@@ -55,6 +55,7 @@ public:
 	void getline(char * buffer, int size);
 	void close();
 	bool eof();
+	bool isValid();
 };
 
 #endif
diff --git a/RayPlatform/RayPlatform/handlers/MasterModeExecutor.cpp b/RayPlatform/RayPlatform/handlers/MasterModeExecutor.cpp
index c7db0a9..bec0907 100644
--- a/RayPlatform/RayPlatform/handlers/MasterModeExecutor.cpp
+++ b/RayPlatform/RayPlatform/handlers/MasterModeExecutor.cpp
@@ -23,7 +23,7 @@
 #include <RayPlatform/core/types.h>
 
 #include <stdlib.h> /* for NULL */
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -66,7 +66,7 @@ MasterModeExecutor::MasterModeExecutor(){
 
 void MasterModeExecutor::setObjectHandler(MasterMode mode,MasterModeHandlerReference object){
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(mode>=0);
 	assert(mode < MAXIMUM_NUMBER_OF_MASTER_HANDLERS);
 #endif
diff --git a/RayPlatform/RayPlatform/handlers/MessageTagExecutor.cpp b/RayPlatform/RayPlatform/handlers/MessageTagExecutor.cpp
index 4dcd441..3441181 100644
--- a/RayPlatform/RayPlatform/handlers/MessageTagExecutor.cpp
+++ b/RayPlatform/RayPlatform/handlers/MessageTagExecutor.cpp
@@ -23,7 +23,7 @@
 
 #include <RayPlatform/communication/mpi_tags.h>
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 #include <stdlib.h> /* for NULL */
@@ -64,7 +64,7 @@ MessageTagExecutor::MessageTagExecutor(){
 
 void MessageTagExecutor::setObjectHandler(MessageTag messageTag,MessageTagHandlerReference object){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(messageTag>=0);
 	assert(messageTag < MAXIMUM_NUMBER_OF_TAG_HANDLERS);
 	#endif
diff --git a/RayPlatform/RayPlatform/handlers/SlaveModeExecutor.cpp b/RayPlatform/RayPlatform/handlers/SlaveModeExecutor.cpp
index b1ca151..75041ce 100644
--- a/RayPlatform/RayPlatform/handlers/SlaveModeExecutor.cpp
+++ b/RayPlatform/RayPlatform/handlers/SlaveModeExecutor.cpp
@@ -20,7 +20,7 @@
 
 #include "SlaveModeExecutor.h"
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 #include <stdlib.h> /* for NULL */
@@ -61,7 +61,7 @@ SlaveModeExecutor::SlaveModeExecutor(){
 
 void SlaveModeExecutor::setObjectHandler(SlaveMode mode,SlaveModeHandlerReference object){
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(mode>=0);
 	assert(mode<MAXIMUM_NUMBER_OF_SLAVE_HANDLERS);
 #endif
diff --git a/RayPlatform/RayPlatform/memory/ChunkAllocatorWithDefragmentation.cpp b/RayPlatform/RayPlatform/memory/ChunkAllocatorWithDefragmentation.cpp
index 94a97c5..3d74ce8 100644
--- a/RayPlatform/RayPlatform/memory/ChunkAllocatorWithDefragmentation.cpp
+++ b/RayPlatform/RayPlatform/memory/ChunkAllocatorWithDefragmentation.cpp
@@ -21,7 +21,7 @@
 #include "ChunkAllocatorWithDefragmentation.h"
 #include "allocator.h"
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 #include <iostream>
@@ -42,7 +42,7 @@ void ChunkAllocatorWithDefragmentation::print(){
 
 	for(int i=0;i<m_numberOfLanes;i++){
 		DefragmentationLane*lane=m_defragmentationLanes[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(lane!=NULL);
 		#endif
 		cout<<"DefragmentationGroup objects in DefragmentationLane # "<<lane->getNumber()<<endl;
@@ -142,7 +142,7 @@ void ChunkAllocatorWithDefragmentation::updateFastLane(int n){
 SmartPointer ChunkAllocatorWithDefragmentation::allocate(int n){ /** 64 is the number of buckets in a MyHashTableGroup */
 
 	// presently, this code only allocate things between 1 and 64 * sizeof(something)
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(!(n>=1 && n<=64))
 		cout<<"n= "<<n<<endl;
 	assert(n>=1&&n<=64);
diff --git a/RayPlatform/RayPlatform/memory/DefragmentationGroup.cpp b/RayPlatform/RayPlatform/memory/DefragmentationGroup.cpp
index 9bb6fe2..b856028 100644
--- a/RayPlatform/RayPlatform/memory/DefragmentationGroup.cpp
+++ b/RayPlatform/RayPlatform/memory/DefragmentationGroup.cpp
@@ -35,7 +35,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef  ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -55,7 +55,7 @@ bool DefragmentationGroup::canAllocate(int n){
 	/* we want fast allocation in the end...  
 	if a contiguous segment is not available, we can't handle it... 
 */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((ELEMENTS_PER_GROUP-m_freeSliceStart)<=m_availableElements);
 	#endif
 
@@ -108,7 +108,7 @@ SmallSmartPointer DefragmentationGroup::allocate(int n,
 	m_operations[__OPERATION_ALLOCATE]++;
 
 	/* verify pre-conditions */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(n>0);
 	assert(canAllocate(n));
 	assert(n<=ELEMENTS_PER_GROUP);
@@ -126,7 +126,7 @@ SmallSmartPointer DefragmentationGroup::allocate(int n,
 	SmallSmartPointer returnValue=getAvailableSmallSmartPointer();
 
 	/* make sure that this handle is not used already */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedSizes[returnValue]==0);
 	#endif
 
@@ -135,7 +135,7 @@ SmallSmartPointer DefragmentationGroup::allocate(int n,
 	m_allocatedSizes[returnValue]=n;
 
 	/** make sure that the meta-data was stored correctly */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_allocatedSizes[returnValue]==n);
 	assert(m_allocatedOffsets[returnValue]==m_freeSliceStart);
 	#endif
@@ -161,7 +161,7 @@ SmallSmartPointer DefragmentationGroup::allocate(int n,
 	
 	// make sure that the number of available elements
 	// is valid
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_availableElements<0)
 		cout<<"m_availableElements "<<m_availableElements<<endl;
 	assert(m_availableElements>=0);
@@ -265,7 +265,7 @@ void DefragmentationGroup::deallocate(SmallSmartPointer a,int bytesPerElement,ui
 	}
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_allocatedSizes[a]==0)
 		cout<<__func__<<" SmallSmartPointer "<<(int)a<<" has size 0."<<endl;
 	assert(m_allocatedSizes[a]>0);
@@ -301,7 +301,7 @@ void DefragmentationGroup::deallocate(SmallSmartPointer a,int bytesPerElement,ui
 	/* we have more elements available now */
 	m_availableElements+=allocatedSize;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableElements<=ELEMENTS_PER_GROUP);
 	assert(m_availableElements>=0);
 	if(!((ELEMENTS_PER_GROUP-m_freeSliceStart)<=m_availableElements))
@@ -323,13 +323,13 @@ void DefragmentationGroup::constructor(int bytesPerElement,bool show){
 	m_operations[__OPERATION_DEALLOCATE]=0;
 	m_operations[__OPERATION_DEFRAGMENT]=0;
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_block==NULL);
 	#endif
 
 	m_availableElements=ELEMENTS_PER_GROUP;
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableElements<=ELEMENTS_PER_GROUP);
 	assert(m_availableElements>=0);
 	#endif
@@ -350,7 +350,7 @@ void DefragmentationGroup::constructor(int bytesPerElement,bool show){
 		m_allocatedOffsets[i]=0;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((ELEMENTS_PER_GROUP-m_freeSliceStart)<=m_availableElements);
 	#endif
 }
@@ -371,7 +371,7 @@ void DefragmentationGroup::destructor(bool show){
  * Resolvee a SmallSmartPointer
  */
 void*DefragmentationGroup::getPointer(SmallSmartPointer a,int bytesPerElement){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_allocatedSizes[a]==0)
 		cout<<"this= "<<this<<" can not getPointer on SmallSmartPointer "<<(int)a<<" because it is not allocated."<<endl;
 	assert(m_allocatedSizes[a]!=0);
@@ -401,7 +401,7 @@ bool DefragmentationGroup::isOnline(){
  * Get the number of available elements
  */
 int DefragmentationGroup::getAvailableElements(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_block!=NULL);
 	assert(m_availableElements<=ELEMENTS_PER_GROUP);
 	assert(m_availableElements>=0);
@@ -457,7 +457,7 @@ bool DefragmentationGroup::defragment(int bytesPerElement,uint16_t*cellContents,
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((ELEMENTS_PER_GROUP-m_freeSliceStart)<=m_availableElements);
 	#endif
 
@@ -489,7 +489,7 @@ bool DefragmentationGroup::defragment(int bytesPerElement,uint16_t*cellContents,
 
 		/* at this point, source points to a offset where a SmallSmartPointer starts */
 		/* and destination is an empty space. */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(!(source>destination)){
 			cout<<"destination "<<destination<<" source "<<source<<endl;
 			print();
@@ -497,7 +497,7 @@ bool DefragmentationGroup::defragment(int bytesPerElement,uint16_t*cellContents,
 		assert(source>destination);
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(cellOccupancies[destination]==0);
 		assert(cellOccupancies[source]==1);
 		#endif
@@ -506,7 +506,7 @@ bool DefragmentationGroup::defragment(int bytesPerElement,uint16_t*cellContents,
 		/* copy the data */
 		SmallSmartPointer smartPointer=cellContents[source];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(cellOccupancies[source-1]==0);
 		if(!(m_allocatedSizes[smartPointer]!=0)){
 			cout<<"SmallSmartPointer "<<smartPointer<<" must move, but is has size 0 and bit is 1"<<endl;
@@ -562,7 +562,7 @@ bool DefragmentationGroup::defragment(int bytesPerElement,uint16_t*cellContents,
 	
 	m_freeSliceStart=destination;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((ELEMENTS_PER_GROUP-m_freeSliceStart)<=m_availableElements);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/memory/DefragmentationLane.cpp b/RayPlatform/RayPlatform/memory/DefragmentationLane.cpp
index 7384201..deb61ea 100644
--- a/RayPlatform/RayPlatform/memory/DefragmentationLane.cpp
+++ b/RayPlatform/RayPlatform/memory/DefragmentationLane.cpp
@@ -75,7 +75,7 @@ void DefragmentationLane::getFastGroup(int n,int bytesPerElement,bool show){
 	/* no more group can be created and therefore the DefragmentationLane is too busy */
 	if(m_numberOfActiveGroups==GROUPS_PER_LANE){
 		m_fastGroup=INVALID_GROUP;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_numberOfFastGroups==0);
 		#endif
 		return;
@@ -90,7 +90,7 @@ void DefragmentationLane::getFastGroup(int n,int bytesPerElement,bool show){
 	m_numberOfActiveGroups++;
 	m_numberOfFastGroups++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfFastGroups==1);
 	#endif
 
@@ -118,7 +118,7 @@ SmallSmartPointer DefragmentationLane::allocate(int n,int bytesPerElement,int*gr
 uint16_t*cellContents,
 	uint8_t*cellOccupancies ){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_fastGroup!=-1);
 	if(!(m_fastGroup<GROUPS_PER_LANE))
 		cout<<"m_fastGroup= "<<m_fastGroup<<endl;
@@ -151,7 +151,7 @@ int DefragmentationLane::getNumber(){
  * Time complexity: O(1)
  */
 DefragmentationGroup*DefragmentationLane::getGroup(int i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i<GROUPS_PER_LANE);
 	#endif
 	return m_groups+i;
diff --git a/RayPlatform/RayPlatform/memory/DirtyBuffer.h b/RayPlatform/RayPlatform/memory/DirtyBuffer.h
index 8bdc15e..8333ae0 100644
--- a/RayPlatform/RayPlatform/memory/DirtyBuffer.h
+++ b/RayPlatform/RayPlatform/memory/DirtyBuffer.h
@@ -33,6 +33,9 @@
  */
 class DirtyBuffer{
 
+	/**
+	 * This entry is occupied if the buffer is not NULL.
+	 */
 	void * m_buffer;
 	MPI_Request m_messageRequest;
 	Rank m_destination;
diff --git a/RayPlatform/RayPlatform/memory/MyAllocator.cpp b/RayPlatform/RayPlatform/memory/MyAllocator.cpp
index 49334db..1543c6a 100644
--- a/RayPlatform/RayPlatform/memory/MyAllocator.cpp
+++ b/RayPlatform/RayPlatform/memory/MyAllocator.cpp
@@ -50,7 +50,7 @@ void MyAllocator::constructor(int chunkSize,const char*type,bool show){
 /**  add a chunk of memory */
 void MyAllocator::addChunk(){
 	void*currentChunk=(void*)__Malloc(m_CHUNK_SIZE,m_type,m_show);
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(currentChunk!=NULL);
 	#endif
 	m_chunks.push_back(currentChunk);
@@ -63,7 +63,7 @@ void MyAllocator::addChunk(){
  * a new one is created
  */
 void*MyAllocator::allocate(int s){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(s!=0);
 	#endif
 
@@ -81,12 +81,12 @@ void*MyAllocator::allocate(int s){
 	if(s%8!=0){
 		s=roundNumber(s,alignment);
 	}
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(s%8==0);
 	#endif
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(s>m_CHUNK_SIZE){
 		cout<<"Requested "<<s<<" -- only have "<<m_CHUNK_SIZE<<endl;
 	}
@@ -109,7 +109,7 @@ void*MyAllocator::allocate(int s){
 		return allocate(s);
 	}
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_currentChunkId>=(int)m_chunks.size()){
 		cout<<"ChunkId="<<m_currentChunkId<<" Chunks="<<m_chunks.size()<<endl;
 	}
@@ -128,7 +128,7 @@ void*MyAllocator::allocate(int s){
 	// increase the current position.
 	m_currentPosition+=s;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_currentPosition >= 0 && m_currentPosition <= m_CHUNK_SIZE);
 
 	/* make sure that we can dereference r and use s bytes */
diff --git a/RayPlatform/RayPlatform/memory/ReusableMemoryStore.cpp b/RayPlatform/RayPlatform/memory/ReusableMemoryStore.cpp
index 9ab0d0e..21986d9 100644
--- a/RayPlatform/RayPlatform/memory/ReusableMemoryStore.cpp
+++ b/RayPlatform/RayPlatform/memory/ReusableMemoryStore.cpp
@@ -33,7 +33,7 @@ void ReusableMemoryStore::constructor(){
  */
 bool ReusableMemoryStore::hasAddressesToReuse(int size){
 	bool test=m_toReuse.count(size)>0;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(test){
 		assert(m_toReuse[size]!=NULL);
 	}
@@ -42,13 +42,13 @@ bool ReusableMemoryStore::hasAddressesToReuse(int size){
 }
 
 void*ReusableMemoryStore::reuseAddress(int size){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_toReuse.count(size)>0 && m_toReuse[size]!=NULL);
 	#endif
 
 	Element*tmp=m_toReuse[size];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(tmp!=NULL);
 	#endif
 
@@ -58,7 +58,7 @@ void*ReusableMemoryStore::reuseAddress(int size){
 		m_toReuse.erase(size);
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_toReuse.count(size)>0){
 		assert(m_toReuse[size]!=NULL);
 	}
@@ -75,7 +75,7 @@ void ReusableMemoryStore::addAddressToReuse(void*p,int size){
 		return;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(p!=NULL);
 	#endif
 
@@ -84,7 +84,7 @@ void ReusableMemoryStore::addAddressToReuse(void*p,int size){
 	if(m_toReuse.count(size)>0){
 		Element*next=m_toReuse[size];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(next!=NULL);
 		#endif
 
@@ -104,7 +104,7 @@ void ReusableMemoryStore::print(){
 		i!=m_toReuse.end();i++){
 		int bytes=i->first;
 		Element*ptr=i->second;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(ptr!=NULL);
 		#endif
 		int count=0;
diff --git a/RayPlatform/RayPlatform/memory/RingAllocator.cpp b/RayPlatform/RayPlatform/memory/RingAllocator.cpp
index 3c0702c..880cb77 100644
--- a/RayPlatform/RayPlatform/memory/RingAllocator.cpp
+++ b/RayPlatform/RayPlatform/memory/RingAllocator.cpp
@@ -46,7 +46,7 @@ void RingAllocator::constructor(int chunks,int size,const char*type,bool show){
 	resetCount();
 
 	/* m_max should never be 0 */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(size>0);
 	assert(chunks>0);
 	#endif /* ASSERT */
@@ -55,7 +55,7 @@ void RingAllocator::constructor(int chunks,int size,const char*type,bool show){
 
 	m_max=size;// maximum buffer size in bytes
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_chunks==chunks);
 	assert(m_max==size);
 	#endif /* ASSERT */
@@ -64,17 +64,17 @@ void RingAllocator::constructor(int chunks,int size,const char*type,bool show){
 
 	m_numberOfBytes=m_chunks*m_max;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfBytes>0);
 	#endif /* ASSERT */
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_memory==NULL);
 	#endif
 
 	m_memory=(uint8_t*)__Malloc(sizeof(uint8_t)*m_numberOfBytes,m_type,show);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_memory!=NULL);
 	#endif
 
@@ -98,7 +98,7 @@ void RingAllocator::constructor(int chunks,int size,const char*type,bool show){
 	cout<<"[RingAllocator] m_chunks: "<<m_chunks<<" m_max: "<<m_max<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(size>0);
 	assert(chunks>0);
 
@@ -146,7 +146,7 @@ void*RingAllocator::allocate(int a){
 
 	m_count++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_chunks>0);
 	
 	if(m_memory==NULL)
@@ -187,7 +187,7 @@ void*RingAllocator::allocate(int a){
 	}
 
 	// if all buffers are dirty, we throw a runtime error
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_current==origin && m_bufferStates[m_current]==BUFFER_STATE_DIRTY){
 		cout<<"Error: all buffers are dirty !, chunks: "<<m_chunks<<endl;
 		assert(m_current!=origin);
@@ -206,7 +206,7 @@ void*RingAllocator::allocate(int a){
 		m_current=0;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(address!=NULL);
 	#endif
 
@@ -224,7 +224,7 @@ void RingAllocator::salvageBuffer(void*buffer){
 
 	m_availableBuffers++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableBuffers>=1);
 	#endif
 
@@ -239,13 +239,13 @@ void RingAllocator::markBufferAsDirty(void*buffer){
 	cout<<"[RingAllocator::markBufferAsDirty] "<<bufferNumber<<" -> BUFFER_STATE_DIRTY"<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableBuffers>=1);
 	#endif
 
 	m_availableBuffers--;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableBuffers>=0);
 	#endif
 }
@@ -257,6 +257,14 @@ int RingAllocator::getBufferHandle(void*buffer){
 	uint64_t originValue=(uint64_t)origin;
 	uint64_t bufferValue=(uint64_t)buffer;
 
+#ifdef CONFIG_ASSERT
+	if(!(bufferValue >= originValue)) {
+		cout << "Error: buffer is too low: " << buffer;
+		cout << " but base is " << (void*)m_memory << endl;
+	}
+	assert(bufferValue >= originValue);
+#endif
+
 	uint64_t difference=bufferValue-originValue;
 
 	int index=difference/(m_max*sizeof(uint8_t));
@@ -331,7 +339,7 @@ DirtyBuffer*RingAllocator::getDirtyBuffers(){
  */
 void RingAllocator::checkDirtyBuffer(int index){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfDirtyBuffers>0);
 	#endif
 
@@ -349,7 +357,7 @@ void RingAllocator::checkDirtyBuffer(int index){
 	if(!flag)// this slot is not ready
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert( flag );
 	#endif /* ASSERT */
 
@@ -361,7 +369,7 @@ void RingAllocator::checkDirtyBuffer(int index){
 	cout<<"From checkDirtyBuffer flag= "<<flag<<endl;
 	#endif /* COMMUNICATION_IS_VERBOSE */
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(*request == MPI_REQUEST_NULL);
 	#endif /* ASSERT */
 
@@ -376,7 +384,7 @@ void RingAllocator::cleanDirtyBuffers(){
 	if(m_numberOfDirtyBuffers<m_minimumNumberOfDirtyBuffersForSweep)
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfDirtyBuffers>0);
 	#endif
 
@@ -484,16 +492,18 @@ MPI_Request * RingAllocator::registerBuffer(void*buffer){
 	MPI_Request*request=NULL;
 
 	// this buffer is not registered.
-	if(handle >=0 && m_dirtyBuffers[handle].getBuffer() == NULL)
+	if(handle >=0 && m_dirtyBuffers[handle].getBuffer() == NULL) {
 		mustRegister=true;
+	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
+	assert(handle >= 0 && handle < m_dirtyBufferSlots);
 	assert(m_dirtyBuffers[handle].getBuffer() == NULL);
 	#endif
 
 	/* register the buffer for processing */
 	if(mustRegister){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_dirtyBuffers[handle].getBuffer() == NULL);
 		#endif
 
@@ -505,8 +515,9 @@ MPI_Request * RingAllocator::registerBuffer(void*buffer){
 		m_dirtyBuffers[handle].m_messageTag=tag;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_dirtyBuffers[handle].getBuffer() != NULL);
+		assert(m_dirtyBuffers[handle].getBuffer() == buffer);
 		#endif
 
 		request = (m_dirtyBuffers[handle].getRequest());
@@ -532,5 +543,14 @@ void RingAllocator::printStatus(){
 	cout<<"Rank "<<m_rank<<": "<<m_linearSweeps<<" linear sweep operations (threshold: ";
 	cout<<m_minimumNumberOfDirtyBuffersForSweep<<" dirty buffers)"<<endl;
 	#endif
+}
+
+void RingAllocator::printBufferStatus() const {
 
+	cout << "[RingAllocator] circular buffer recycling system -> ";
+	cout << "| All " << m_chunks << "";
+	cout << "| BUFFER_STATE_AVAILABLE " << m_availableBuffers<< "";
+	cout << "| BUFFER_STATE_DIRTY " << m_numberOfDirtyBuffers << "";
+	cout << "| SweepCount " << m_linearSweeps;
+	cout << endl;
 }
diff --git a/RayPlatform/RayPlatform/memory/RingAllocator.h b/RayPlatform/RayPlatform/memory/RingAllocator.h
index 263c7c5..21996b2 100644
--- a/RayPlatform/RayPlatform/memory/RingAllocator.h
+++ b/RayPlatform/RayPlatform/memory/RingAllocator.h
@@ -137,6 +137,7 @@ public:
 	void printStatus();
 
 	bool isRegistered(int handle);
+	void printBufferStatus() const;
 };
 
 
diff --git a/RayPlatform/RayPlatform/memory/allocator.cpp b/RayPlatform/RayPlatform/memory/allocator.cpp
index 46ea333..2d8bf34 100644
--- a/RayPlatform/RayPlatform/memory/allocator.cpp
+++ b/RayPlatform/RayPlatform/memory/allocator.cpp
@@ -33,7 +33,7 @@ using namespace std;
  * wrapper around malloc
  */
 void*__Malloc(int c,const char*description,bool show){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(c==0){
 		cout<<"Requested "<<c<<" bytes of type "<<description<<endl;
 	}
diff --git a/RayPlatform/RayPlatform/profiling/TickLogger.cpp b/RayPlatform/RayPlatform/profiling/TickLogger.cpp
index f923490..5c3496a 100644
--- a/RayPlatform/RayPlatform/profiling/TickLogger.cpp
+++ b/RayPlatform/RayPlatform/profiling/TickLogger.cpp
@@ -31,7 +31,7 @@ using namespace std;
 #define CONFIG_TICK_STEPPING 1000000
 
 void TickLogger::logSlaveTick(SlaveMode i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i!=INVALID_HANDLE);
 	#endif
 
@@ -76,7 +76,7 @@ void TickLogger::logSlaveTick(SlaveMode i){
 }
 
 void TickLogger::logMasterTick(MasterMode i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i!=INVALID_HANDLE);
 	#endif
 
@@ -133,7 +133,7 @@ void TickLogger::printSlaveTicks(ofstream*file){
 
 	// print stuff
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_slaveModes.size()==m_slaveCounts.size());
 	assert(m_slaveModes.size()==m_slaveStarts.size());
 	assert(m_slaveModes.size()==m_slaveEnds.size());
@@ -173,7 +173,7 @@ void TickLogger::printSlaveTicks(ofstream*file){
 		uint64_t granularity=delta;
 		granularity*=1000*1000;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(ticks!=0);
 		#endif
 
@@ -224,7 +224,7 @@ void TickLogger::printMasterTicks(ofstream*file){
 
 	// print stuff
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_masterModes.size()==m_masterCounts.size());
 	assert(m_masterModes.size()==m_masterStarts.size());
 	assert(m_masterModes.size()==m_masterEnds.size());
@@ -264,7 +264,7 @@ void TickLogger::printMasterTicks(ofstream*file){
 		uint64_t granularity=delta;
 		granularity*=1000*1000;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(ticks!=0);
 		#endif
 
diff --git a/RayPlatform/RayPlatform/routing/GraphImplementationDeBruijn.cpp b/RayPlatform/RayPlatform/routing/GraphImplementationDeBruijn.cpp
index ec27557..b98ccdd 100644
--- a/RayPlatform/RayPlatform/routing/GraphImplementationDeBruijn.cpp
+++ b/RayPlatform/RayPlatform/routing/GraphImplementationDeBruijn.cpp
@@ -160,7 +160,7 @@ void GraphImplementationDeBruijn::computeRoute(Rank source,Rank destination,vect
 Rank GraphImplementationDeBruijn::getNextRankInRoute(Rank source,Rank destination,Rank rank){
 	#ifdef CONFIG_ROUTING_DE_BRUIJN_COMPUTE_ROUTES
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_routes[source][destination].count(rank)==1);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/GraphImplementationExperimental.cpp b/RayPlatform/RayPlatform/routing/GraphImplementationExperimental.cpp
index a9b033d..076b4ff 100644
--- a/RayPlatform/RayPlatform/routing/GraphImplementationExperimental.cpp
+++ b/RayPlatform/RayPlatform/routing/GraphImplementationExperimental.cpp
@@ -208,7 +208,7 @@ void GraphImplementationExperimental::computeRoute(Rank source,Rank destination,
 Rank GraphImplementationExperimental::getNextRankInRoute(Rank source,Rank destination,Rank rank){
 	#ifdef CONFIG_ROUTING_DE_KAUTZ_COMPUTE_ROUTES
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_routes[source][destination].count(rank)==1);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/GraphImplementationGroup.cpp b/RayPlatform/RayPlatform/routing/GraphImplementationGroup.cpp
index fae665c..3b0a940 100644
--- a/RayPlatform/RayPlatform/routing/GraphImplementationGroup.cpp
+++ b/RayPlatform/RayPlatform/routing/GraphImplementationGroup.cpp
@@ -128,7 +128,7 @@ void GraphImplementationGroup::makeRoutes(){
 }
 
 Rank GraphImplementationGroup::getNextRankInRoute(Rank source,Rank destination,Rank rank){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_routes[source][destination].count(rank)==1);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/GraphImplementationKautz.cpp b/RayPlatform/RayPlatform/routing/GraphImplementationKautz.cpp
index 00c268e..0bb118e 100644
--- a/RayPlatform/RayPlatform/routing/GraphImplementationKautz.cpp
+++ b/RayPlatform/RayPlatform/routing/GraphImplementationKautz.cpp
@@ -170,7 +170,7 @@ void GraphImplementationKautz::computeRoute(Rank source,Rank destination,vector<
 Rank GraphImplementationKautz::getNextRankInRoute(Rank source,Rank destination,Rank rank){
 	#ifdef CONFIG_ROUTING_DE_KAUTZ_COMPUTE_ROUTES
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_routes[source][destination].count(rank)==1);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/GraphImplementationRandom.cpp b/RayPlatform/RayPlatform/routing/GraphImplementationRandom.cpp
index 362e43f..2cf4e15 100644
--- a/RayPlatform/RayPlatform/routing/GraphImplementationRandom.cpp
+++ b/RayPlatform/RayPlatform/routing/GraphImplementationRandom.cpp
@@ -91,7 +91,7 @@ void GraphImplementationRandom::computeRoute(Rank a,Rank b,vector<Rank>*route){
 }
 
 Rank GraphImplementationRandom::getNextRankInRoute(Rank source,Rank destination,Rank rank){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_routes[source][destination].count(rank)==1);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/Polytope.cpp b/RayPlatform/RayPlatform/routing/Polytope.cpp
index fde8ed7..dad85d7 100644
--- a/RayPlatform/RayPlatform/routing/Polytope.cpp
+++ b/RayPlatform/RayPlatform/routing/Polytope.cpp
@@ -24,7 +24,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif /* ASSERT */
 
@@ -171,7 +171,7 @@ void Polytope::configureGraph(int n){
 		digits++;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(n==getPower(base,digits));
 	#endif
 
@@ -189,7 +189,7 @@ void Polytope::setLoad(int position,int symbol,uint64_t value){
 
 uint64_t Polytope::getLoad(int position,int symbol){
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(position<m_wordLength);
 	assert(symbol<m_alphabetSize);
 	#endif /* ASSERT */
@@ -328,7 +328,7 @@ void Polytope::makeRoutes(){
  */
 Rank Polytope::computeNextRankInRoute(Rank source,Rank destination,Rank current){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(destination!=current); // we don't need any routing...
 	assert(source>=0);
 	assert(destination>=0);
@@ -394,7 +394,7 @@ Rank Polytope::computeNextRankInRoute(Rank source,Rank destination,Rank current)
 
 	Rank nextRank=convertToBase10(&next);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(current!=nextRank);
 	#endif
 
@@ -501,7 +501,7 @@ void Polytope::start(){
 
 Rank Polytope::computeNextRankInRouteWithRoundRobin(Rank source,Rank destination,Rank current){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(destination!=current); // we don't need any routing...
 	assert(source>=0);
 	assert(destination>=0);
@@ -511,7 +511,7 @@ Rank Polytope::computeNextRankInRouteWithRoundRobin(Rank source,Rank destination
 	assert(current<m_size);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	Tuple*sourceVertex=&(m_graphToVertex[source]);
 	#endif
 
@@ -598,7 +598,7 @@ Rank Polytope::computeNextRankInRouteWithRoundRobin(Rank source,Rank destination
 
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(bestPosition==NO_VALUE){
 		cout<<"Error: found no eligible position."<<endl;
 		cout<<"m_currentPosition: "<<m_currentPosition<<endl;
@@ -644,7 +644,7 @@ Rank Polytope::computeNextRankInRouteWithRoundRobin(Rank source,Rank destination
 
 	Rank nextRank=convertToBase10(&next);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(current!=nextRank);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/routing/Torus.cpp b/RayPlatform/RayPlatform/routing/Torus.cpp
index 6b48f63..86de2b6 100644
--- a/RayPlatform/RayPlatform/routing/Torus.cpp
+++ b/RayPlatform/RayPlatform/routing/Torus.cpp
@@ -24,7 +24,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif /* ASSERT */
 
@@ -112,7 +112,7 @@ void Torus::configureGraph(int vertices){
 		dimension++;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(vertices ==getPower(theRadix,dimension));
 	#endif
 
@@ -141,7 +141,7 @@ void Torus::setLoad(int position,int symbol,uint64_t value){
 
 uint64_t Torus::getLoad(int position,int symbol){
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(position<m_dimension);
 	assert(symbol<m_radix);
 	#endif /* ASSERT */
@@ -221,7 +221,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
 	cout<<"[DEVEL] getNextRankInRoute source="<<source<<" destination="<<destination<<" current="<<current<<endl;
 #endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(destination!=current); // we don't need any routing...
 	assert(source>=0);
 	assert(destination>=0);
@@ -258,7 +258,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
  */
 		int leftDistance=getDistance(currentSymbol,destinationSymbol);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(leftDistance!=0);
 		assert(leftDistance>0);
 		assert(leftDistance>=1);
@@ -269,7 +269,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
  */
 		int rightDistance=getDistance(destinationSymbol,currentSymbol);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(rightDistance!=0);
 		assert(rightDistance>0);
 		assert(rightDistance>=1);
@@ -279,7 +279,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
 
 			int nextSymbol=decrementSymbol(currentSymbol);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(getMinimumDistance(currentSymbol,nextSymbol)==1);
 			assert(getMinimumDistance(nextSymbol,currentSymbol)==1);
 			#endif
@@ -300,7 +300,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
 
 			int nextSymbol=incrementSymbol(currentSymbol);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(getMinimumDistance(currentSymbol,nextSymbol)==1);
 			assert(getMinimumDistance(nextSymbol,currentSymbol)==1);
 			#endif
@@ -318,7 +318,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bestPosition!=NO_VALUE);
 	assert(bestPosition>=0);
 	assert(bestPosition<m_dimension);
@@ -357,7 +357,7 @@ Rank Torus::getNextRankInRoute(Rank source,Rank destination,Rank current){
 
 	Rank nextRank=convertToBase10(&next);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(current!=nextRank);
 	assert(computeConnection(current,nextRank) == true);
 	#endif
@@ -532,7 +532,7 @@ void Torus::printStatus(Rank rank){
 			cout<<" ("<<other<<")";
 			cout<<" Load: "<<load<<endl;
 			
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(computeConnection(rank,other)!=true){
 				cout<<"Error: position="<<position<<" otherSymbol= "<<otherSymbol<<", load="<<load<<" but the edge does not exist."<<endl;
 			}
@@ -547,7 +547,7 @@ void Torus::start(){
 		for(int j=0;j<m_radix;j++)
 			setLoad(i,j,0);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 
 	for(int i=0;i<m_dimension;i++)
 		for(int j=0;j<m_radix;j++)
diff --git a/RayPlatform/RayPlatform/scheduling/SwitchMan.cpp b/RayPlatform/RayPlatform/scheduling/SwitchMan.cpp
index 30ec265..93c8ba0 100644
--- a/RayPlatform/RayPlatform/scheduling/SwitchMan.cpp
+++ b/RayPlatform/RayPlatform/scheduling/SwitchMan.cpp
@@ -37,7 +37,7 @@ __CreateSlaveModeAdapter(SwitchMan,RAY_SLAVE_MODE_STOP);
 
 void SwitchMan::constructor(Rank rank,int numberOfCores){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(rank>=0);
 	assert(numberOfCores>=0);
 	#endif
@@ -46,7 +46,7 @@ void SwitchMan::constructor(Rank rank,int numberOfCores){
 	m_size=numberOfCores;
 	reset();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	runAssertions();
 	#endif
 
@@ -55,13 +55,13 @@ void SwitchMan::constructor(Rank rank,int numberOfCores){
 /** reset the sole counter */
 void SwitchMan::reset(){
 	m_counter=0;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	runAssertions();
 	#endif
 }
 
 bool SwitchMan::allRanksAreReady(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	runAssertions();
 	#endif
 
@@ -76,7 +76,7 @@ void SwitchMan::closeSlaveMode(Rank source){
 
 	m_counter++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	runAssertions();
 	#endif
 }
@@ -92,7 +92,7 @@ void SwitchMan::runAssertions(){
 
 
 MasterMode SwitchMan::getNextMasterMode(MasterMode currentMode){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_switches.count(currentMode)==0){
 		cout<<"CurrentMode= "<<MASTER_MODES[currentMode]<<endl;
 	}
@@ -107,7 +107,7 @@ MasterMode SwitchMan::getNextMasterMode(MasterMode currentMode){
 }
 
 void SwitchMan::addNextMasterMode(MasterMode a,MasterMode b){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_switches.count(a)==0);
 	#endif
 
@@ -120,7 +120,7 @@ void SwitchMan::openSlaveMode(MessageTag tag,StaticVector*outbox,Rank source,Ran
 	cout << " message on bus: " << MESSAGE_TAGS[tag] <<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(source == MASTER_RANK); // only master can do that
 	#endif
 
@@ -143,7 +143,7 @@ void SwitchMan::closeSlaveModeLocally(StaticVector*outbox,Rank source){
 
 void SwitchMan::openMasterMode(StaticVector*outbox,Rank source){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_masterModeToTagTable.count(m_masterMode)==0){
 		cout<<"Error, master mode is "<<MASTER_MODES[m_masterMode]<<endl;
 	}
@@ -158,7 +158,7 @@ void SwitchMan::openMasterMode(StaticVector*outbox,Rank source){
 	cout<<"[SwitchMan::openMasterMode] tag= "<<MESSAGE_TAGS[tag]<<" source= "<<source<<" Outbox= "<<outbox<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(source==MASTER_RANK);
 	assert(outbox!=NULL);
 	#endif
@@ -241,7 +241,7 @@ void SwitchMan::openSlaveModeLocally(MessageTag tag,Rank rank){
 }
 
 void SwitchMan::addSlaveSwitch(MessageTag tag,SlaveMode slaveMode){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_tagToSlaveModeTable.count(tag)==0);
 	#endif
 
@@ -287,7 +287,7 @@ int*SwitchMan::getMasterModePointer(){
 }
 
 void SwitchMan::addMasterSwitch(MasterMode masterMode,MessageTag tag){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_masterModeToTagTable.count(masterMode)==0);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/scheduling/TaskCreator.cpp b/RayPlatform/RayPlatform/scheduling/TaskCreator.cpp
index a345489..929cd9a 100644
--- a/RayPlatform/RayPlatform/scheduling/TaskCreator.cpp
+++ b/RayPlatform/RayPlatform/scheduling/TaskCreator.cpp
@@ -22,7 +22,7 @@
 
 #include <stdlib.h> /* for NULL */
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -48,7 +48,7 @@ void TaskCreator::mainLoop(){
 			cout<<"Adding worker to pool worker= "<<worker<<" processor="<<m_virtualProcessor<<endl;
 			#endif
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(worker != NULL);
 			assert(m_virtualProcessor != NULL);
 			#endif
diff --git a/RayPlatform/RayPlatform/scheduling/VirtualProcessor.cpp b/RayPlatform/RayPlatform/scheduling/VirtualProcessor.cpp
index 5201820..aad7154 100644
--- a/RayPlatform/RayPlatform/scheduling/VirtualProcessor.cpp
+++ b/RayPlatform/RayPlatform/scheduling/VirtualProcessor.cpp
@@ -25,7 +25,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -40,7 +40,7 @@ void VirtualProcessor::updateStates(){
 	for(int i=0;i<(int)m_workersDone.size();i++){
 		WorkerHandle workerId=m_workersDone[i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		assert(m_aliveWorkers.count(workerId)>0);
 		#endif
@@ -60,7 +60,7 @@ void VirtualProcessor::updateStates(){
 	for(int i=0;i<(int)m_waitingWorkers.size();i++){
 		WorkerHandle workerId=m_waitingWorkers[i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		#endif
 
@@ -133,7 +133,7 @@ bool VirtualProcessor::run(){
 		/** save the current worker identifier */
 		m_currentWorker=workerId;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(m_aliveWorkers.count(workerId)==0){
 			cout<<"Error: "<<workerId<<" is not in alive workers "<<m_activeWorkers.size()<<endl;
 		}
@@ -208,7 +208,7 @@ bool VirtualProcessor::run(){
 
 /** get the current worker */
 Worker*VirtualProcessor::getCurrentWorker(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_aliveWorkers.count(m_currentWorker) > 0);
 	#endif
 
@@ -222,13 +222,13 @@ bool VirtualProcessor::canAddWorker(){
 
 /** add a worker */
 void VirtualProcessor::addWorker(Worker*worker){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(worker != NULL);
 	#endif
 
 	WorkerHandle workerId=worker->getWorkerIdentifier();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_aliveWorkers.count(workerId)>0)
 		cout<<"Worker "<<workerId<<" already here"<<endl;
 	assert(m_aliveWorkers.count(workerId) == 0);
diff --git a/RayPlatform/RayPlatform/structures/MyHashTable.h b/RayPlatform/RayPlatform/structures/MyHashTable.h
index 9761a2e..32c8347 100644
--- a/RayPlatform/RayPlatform/structures/MyHashTable.h
+++ b/RayPlatform/RayPlatform/structures/MyHashTable.h
@@ -248,7 +248,7 @@ VALUE*MyHashTable<KEY,VALUE>::at(uint64_t bucket){
 	int group=bucket/m_numberOfBucketsInGroup;
 	int bucketInGroup=bucket%m_numberOfBucketsInGroup;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_groups[group].getBit(bucketInGroup)==1);
 	#endif
 
@@ -294,7 +294,7 @@ void MyHashTable<KEY,VALUE>::growIfNecessary(){
 		printProbeStatistics();
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_auxiliaryTableForIncrementalResize==NULL);
 	#endif
 
@@ -307,7 +307,7 @@ void MyHashTable<KEY,VALUE>::growIfNecessary(){
 	//cout<<"Rank "<<m_rank<<" MyHashTable must grow now "<<m_totalNumberOfBuckets<<" -> "<<newSize<<endl;
 	//printStatistics();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(newSize>m_totalNumberOfBuckets);
 	#endif
 }
@@ -317,7 +317,7 @@ void MyHashTable<KEY,VALUE>::growIfNecessary(){
  */
 template<class KEY,class VALUE>
 void MyHashTable<KEY,VALUE>::resize(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_resizing==true);
 	assert(m_utilisedBuckets>0);
 	#endif
@@ -388,14 +388,14 @@ void MyHashTable<KEY,VALUE>::resize(){
 		if(!isAvailable(m_currentBucketToTransfer)){
 			VALUE*entry=at(m_currentBucketToTransfer);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(entry!=NULL);
 			#endif
 
 			KEY keyValue=entry->getKey();
 			KEY*key=&keyValue;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			uint64_t probe;
 			int group;
 			int bucketInGroup;
@@ -416,7 +416,7 @@ void MyHashTable<KEY,VALUE>::resize(){
  * 			fails */
 
 			/** save the size before for further use */
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			uint64_t sizeBefore=m_auxiliaryTableForIncrementalResize->m_utilisedBuckets;
 
 			/* the auxiliary should not contain the key already . */
@@ -432,7 +432,7 @@ void MyHashTable<KEY,VALUE>::resize(){
 			(*insertedEntry)=*entry;
 	
 			/** assert that we inserted something somewhere */
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(m_auxiliaryTableForIncrementalResize->m_utilisedBuckets!=sizeBefore+1)
 				cout<<"Expected: "<<sizeBefore+1<<" Actual: "<<m_auxiliaryTableForIncrementalResize->m_utilisedBuckets<<endl;
 			assert(m_auxiliaryTableForIncrementalResize->m_utilisedBuckets==sizeBefore+1);
@@ -446,7 +446,7 @@ void MyHashTable<KEY,VALUE>::resize(){
 	if(m_currentBucketToTransfer==capacity()){
 		//cout<<"Rank "<<m_rank<<": MyHashTable incremental resizing is complete."<<endl;
 		/* make sure the old table is now empty */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		//assert(size()==0);
 		//the old table still has its stuff.
 		#endif
@@ -462,7 +462,7 @@ void MyHashTable<KEY,VALUE>::resize(){
 		m_utilisedBuckets=m_auxiliaryTableForIncrementalResize->m_utilisedBuckets;
 		m_size=m_auxiliaryTableForIncrementalResize->m_size;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_size == m_utilisedBuckets);
 		assert(m_auxiliaryTableForIncrementalResize->m_resizing == false);
 		assert(m_size == m_utilisedBuckets);
@@ -571,7 +571,7 @@ void MyHashTable<KEY,VALUE>::constructor(uint64_t buckets,const char*mallocType,
 	int requiredBytes=m_numberOfGroups*sizeof(MyHashTableGroup<KEY,VALUE>);
 
 	/** sanity check */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(requiredBytes<=0)
 		cout<<"Groups="<<m_numberOfGroups<<" RequiredBytes="<<requiredBytes<<"  BucketsPower2: "<<m_totalNumberOfBuckets<<endl;
 	assert(requiredBytes>=0);
@@ -581,7 +581,7 @@ void MyHashTable<KEY,VALUE>::constructor(uint64_t buckets,const char*mallocType,
 	m_groups=(MyHashTableGroup<KEY,VALUE>*)__Malloc(requiredBytes,
 		mallocType,showMalloc);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_groups!=NULL);
 	#endif
 
@@ -600,7 +600,7 @@ bool MyHashTable<KEY,VALUE>::isAvailable(uint64_t bucket){
 	int group=bucket/m_numberOfBucketsInGroup;
 	int bucketInGroup=bucket%m_numberOfBucketsInGroup;
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bucket<m_totalNumberOfBuckets);
 	assert(group<m_numberOfGroups);
 	assert(bucketInGroup<m_numberOfBucketsInGroup);
@@ -662,7 +662,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 	(*group)=bucket/m_numberOfBucketsInGroup;
 	(*bucketInGroup)=bucket%m_numberOfBucketsInGroup;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bucket<m_totalNumberOfBuckets);
 	assert(*group<m_numberOfGroups);
 	assert(*bucketInGroup<m_numberOfBucketsInGroup);
@@ -678,7 +678,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 			number of buckets = M = 2^m
 		and the stride is 1 <= s <= M-1 and is odd thus does not share factor with 2^m */
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		/** issue a warning for an unexpected large probe depth */
 		/** each bucket should be probed in exactly NumberOfBuckets probing events */
 		if((*probe)>=m_totalNumberOfBuckets){
@@ -706,7 +706,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 				h2--; 
 
 			/** check boundaries */
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(h2!=0);
 			assert(h2%2!=0);
 			assert(h2%2 == 1);
@@ -721,7 +721,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 			#endif
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(h2!=0);
 		#endif
 		
@@ -737,7 +737,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 		(*bucketInGroup)=bucket%m_numberOfBucketsInGroup;
 
 		/** sanity checks */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bucket<m_totalNumberOfBuckets);
 		assert(*group<m_numberOfGroups);
 		assert(*bucketInGroup<m_numberOfBucketsInGroup);
@@ -745,7 +745,7 @@ void MyHashTable<KEY,VALUE>::findBucketWithKey(KEY*key,uint64_t*probe,int*group,
 	}
 
 	/** sanity checks */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bucket<m_totalNumberOfBuckets);
 	assert(*group<m_numberOfGroups);
 	assert(*bucketInGroup<m_numberOfBucketsInGroup);
@@ -771,7 +771,7 @@ VALUE*MyHashTable<KEY,VALUE>::findKey(KEY*key,bool checkAuxiliary){ /* for verbo
 	int bucketInGroup;
 	findBucketWithKey(key,&probe,&group,&bucketInGroup);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(group<m_numberOfGroups);
 	assert(bucketInGroup<m_numberOfBucketsInGroup);
 	#endif
@@ -803,7 +803,7 @@ VALUE*MyHashTable<KEY,VALUE>::findKey(KEY*key,bool checkAuxiliary){ /* for verbo
  */
 template<class KEY,class VALUE>
 VALUE*MyHashTable<KEY,VALUE>::find(KEY*key){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(key!=NULL);
 	#endif
 
@@ -851,7 +851,7 @@ VALUE*MyHashTable<KEY,VALUE>::insert(KEY*key){
 	// Case 3. Otherwise, the old one is responsible. 
 	//
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	uint64_t beforeSize=m_utilisedBuckets;
 	#endif
 
@@ -861,7 +861,7 @@ VALUE*MyHashTable<KEY,VALUE>::insert(KEY*key){
 	int bucketInGroup;
 	findBucketWithKey(key,&probe,&group,&bucketInGroup);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(group<m_numberOfGroups);
 	assert(bucketInGroup<m_numberOfBucketsInGroup);
 	#endif
@@ -871,7 +871,7 @@ VALUE*MyHashTable<KEY,VALUE>::insert(KEY*key){
 	VALUE*entry=m_groups[group].insert(m_numberOfBucketsInGroup,bucketInGroup,key,&m_allocator,&inserted);
 
 	/* check that nothing failed elsewhere */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(entry!=NULL);
 	if(entry->getKey()!=*key)
 		cout<<"Pointer: "<<entry<<endl;
@@ -890,7 +890,7 @@ VALUE*MyHashTable<KEY,VALUE>::insert(KEY*key){
 		m_probes[probe]++;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(find(key)!=NULL);
 	assert(find(key)->getKey()==*key);
 	if(inserted)
@@ -952,7 +952,7 @@ void MyHashTable<KEY,VALUE>::completeResizing(){
 	while(m_resizing)
 		resize();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_auxiliaryTableForIncrementalResize == NULL);
 	#endif
 
diff --git a/RayPlatform/RayPlatform/structures/MyHashTableGroup.h b/RayPlatform/RayPlatform/structures/MyHashTableGroup.h
index dbd2d5d..c30d2a5 100644
--- a/RayPlatform/RayPlatform/structures/MyHashTableGroup.h
+++ b/RayPlatform/RayPlatform/structures/MyHashTableGroup.h
@@ -123,7 +123,7 @@ void MyHashTableGroup<KEY,VALUE>::setBit(int bit,uint64_t value){
 /**
  * 	just set the bit to value in m_bitmap
  */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(value==1||value==0);
 	#endif
 	
@@ -142,7 +142,7 @@ void MyHashTableGroup<KEY,VALUE>::setBit(int bit,uint64_t value){
 	}
 
 	/** make sure the bit is OK */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(getBit(bit)!=(int)value)
 		cout<<"Bit="<<bit<<" Expected="<<value<<" Actual="<<getBit(bit)<<endl;
 	assert(getBit(bit)==(int)value);
@@ -168,7 +168,7 @@ int MyHashTableGroup<KEY,VALUE>::getBit(int bit){
 	int bitValue=(m_bitmap<<(63-bit))>>63;
 
 	/**  just a sanity check here */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bitValue==0||bitValue==1);
 	#endif
 
@@ -183,7 +183,7 @@ void MyHashTableGroup<KEY,VALUE>::constructor(int numberOfBucketsInGroup,ChunkAl
 
 	/* the number of buckets in a group must be a multiple of 8 */
 	/* why ? => to save memory -- not to waste memory */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	//assert(numberOfBucketsInGroup%8==0);
 	// this is not necessary.
 	#endif
@@ -203,7 +203,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::insert(int numberOfBucketsInGroup,int bucket,
 
 	/* the bucket can not be used by another key than key */
 	/* if it would be the case, then MyHashTable would not have sent key here */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(bucketIsUtilisedBySomeoneElse(bucket,key,allocator)){
 		cout<<"Error, bucket "<<bucket<<" is utilised by another key numberOfBucketsInGroup "<<numberOfBucketsInGroup<<" utilised buckets in group: "<<getUsedBuckets()<<endl;
 	}
@@ -216,7 +216,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::insert(int numberOfBucketsInGroup,int bucket,
 	/* if the bucket is occupied, then it is returned immediately */
 	if(getBit(bucket)==1){
 		VALUE*vectorPointer=(VALUE*)allocator->getPointer(m_vector);
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		VALUE*value=vectorPointer+bucketsBefore;
 		assert(value->getKey()==*key);
 		#endif
@@ -224,18 +224,18 @@ VALUE*MyHashTableGroup<KEY,VALUE>::insert(int numberOfBucketsInGroup,int bucket,
 	}
 
 	/* make sure that it is not occupied by some troll already */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getBit(bucket)==0);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int usedBucketsBefore=getUsedBuckets();
 	#endif
 
 	/* the bucket is not occupied */
 	setBit(bucket,1);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getUsedBuckets()==usedBucketsBefore+1);
 	#endif
 
@@ -270,7 +270,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::insert(int numberOfBucketsInGroup,int bucket,
 	m_vector=newVector;
 
 	/* check that everything is OK now ! */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getBit(bucket)==1);
 	if(getBucket(bucket,allocator)->getKey()!=*key){
 		cout<<"Expected"<<endl;
@@ -285,7 +285,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::insert(int numberOfBucketsInGroup,int bucket,
 	#endif
 
 	/** check that we inserted something somewhere actually */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(find(bucket,key,allocator)!=NULL);
 	assert(find(bucket,key,allocator)->getKey()==*key);
 	#endif
@@ -319,7 +319,7 @@ bool MyHashTableGroup<KEY,VALUE>::bucketIsUtilisedBySomeoneElse(int bucket,KEY*k
 template<class KEY,class VALUE>
 VALUE*MyHashTableGroup<KEY,VALUE>::getBucket(int bucket,ChunkAllocatorWithDefragmentation*allocator){
 	/*  the bucket is not occupied therefore the key does not exist */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getBit(bucket)!=0);
 	if(m_vector==SmartPointer_NULL)
 		cout<<"bucket: "<<bucket<<endl;
@@ -332,7 +332,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::getBucket(int bucket,ChunkAllocatorWithDefrag
 	/* return the bucket */
 	VALUE*vectorPointer=(VALUE*)allocator->getPointer(m_vector);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(vectorPointer!=NULL);
 	#endif
 
@@ -364,7 +364,7 @@ VALUE*MyHashTableGroup<KEY,VALUE>::find(int bucket,KEY*key,ChunkAllocatorWithDef
 	}
 
 	/** the bucket should contains key at this point */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!bucketIsUtilisedBySomeoneElse(bucket,key,allocator));
 	#endif
 
diff --git a/RayPlatform/RayPlatform/structures/MyHashTableIterator.h b/RayPlatform/RayPlatform/structures/MyHashTableIterator.h
index 66a0d91..22600bd 100644
--- a/RayPlatform/RayPlatform/structures/MyHashTableIterator.h
+++ b/RayPlatform/RayPlatform/structures/MyHashTableIterator.h
@@ -49,7 +49,7 @@ void MyHashTableIterator<KEY,VALUE>::constructor(MyHashTable<KEY,VALUE>*a){
 	m_table=a;
 	getNext();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!a->needsToCompleteResizing());
 	#endif
 }
@@ -68,7 +68,7 @@ bool MyHashTableIterator<KEY,VALUE>::hasNext(){
 
 template<class KEY,class VALUE>
 VALUE*MyHashTableIterator<KEY,VALUE>::next(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_i<m_table->capacity());
 	#endif
 	VALUE*a=m_table->at(m_i);
diff --git a/RayPlatform/RayPlatform/structures/MyStack.h b/RayPlatform/RayPlatform/structures/MyStack.h
index 1604abd..0b66502 100644
--- a/RayPlatform/RayPlatform/structures/MyStack.h
+++ b/RayPlatform/RayPlatform/structures/MyStack.h
@@ -68,7 +68,7 @@ int MyStack<TYPE>::size() const{
 
 template<class TYPE>
 void MyStack<TYPE>::push(TYPE a){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_size!=_MAX_STACK_SIZE);
 	#endif
 	m_array[m_size++]=a;
diff --git a/RayPlatform/RayPlatform/structures/SplayTreeIterator.h b/RayPlatform/RayPlatform/structures/SplayTreeIterator.h
index 8f88eee..b6f1d97 100644
--- a/RayPlatform/RayPlatform/structures/SplayTreeIterator.h
+++ b/RayPlatform/RayPlatform/structures/SplayTreeIterator.h
@@ -67,7 +67,7 @@ SplayTreeIterator<TREE_KEY_TYPE,TREE_VALUE_TYPE>::SplayTreeIterator(SplayTree<TR
 
 template<class TREE_KEY_TYPE,class TREE_VALUE_TYPE>
 void SplayTreeIterator<TREE_KEY_TYPE,TREE_VALUE_TYPE>::constructor(SplayTree<TREE_KEY_TYPE,TREE_VALUE_TYPE>*tree){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_stack.size()==0);
 	#endif
 	m_tree=tree;
diff --git a/RayPlatform/RayPlatform/structures/StaticVector.cpp b/RayPlatform/RayPlatform/structures/StaticVector.cpp
index b537eea..8aed4b6 100644
--- a/RayPlatform/RayPlatform/structures/StaticVector.cpp
+++ b/RayPlatform/RayPlatform/structures/StaticVector.cpp
@@ -29,7 +29,7 @@
 void StaticVector::constructor(int size,const char* type,bool show){
 	strcpy(m_type,type);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(size!=0);
 	#endif
 
@@ -43,7 +43,7 @@ Message*StaticVector::operator[](int i){
 }
 
 Message*StaticVector::at(int i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i<m_size);
 	#endif
 	return m_messages+i;
diff --git a/code/CoverageGatherer/CoverageDistribution.cpp b/code/CoverageGatherer/CoverageDistribution.cpp
index e1c82cd..90814f9 100644
--- a/code/CoverageGatherer/CoverageDistribution.cpp
+++ b/code/CoverageGatherer/CoverageDistribution.cpp
@@ -24,7 +24,7 @@
 #include <iostream>
 #include <fstream>
 #include <map>
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 using namespace std;
diff --git a/code/CoverageGatherer/CoverageGatherer.cpp b/code/CoverageGatherer/CoverageGatherer.cpp
index b89fa91..93a6240 100644
--- a/code/CoverageGatherer/CoverageGatherer.cpp
+++ b/code/CoverageGatherer/CoverageGatherer.cpp
@@ -36,7 +36,7 @@
 #include <stdint.h>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -45,7 +45,7 @@ __CreatePlugin(CoverageGatherer);
 __CreateSlaveModeAdapter(CoverageGatherer,RAY_SLAVE_MODE_SEND_DISTRIBUTION);
 
 void CoverageGatherer::writeKmers(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	LargeCount n=0;
 	#endif
 
@@ -75,7 +75,7 @@ void CoverageGatherer::writeKmers(){
 		Kmer key=*(iterator.getKey());
 		CoverageDepth coverage=node->getCoverage(&key);
 		m_distributionOfCoverage[coverage]++;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		n++;
 		#endif
 		string kmerSequence=key.idToWord(m_parameters->getWordSize(),m_parameters->getColorSpaceMode());
@@ -111,7 +111,7 @@ void CoverageGatherer::writeKmers(){
 	flushFileOperationBuffer_FILE(true, &buffer, kmerFile, CONFIG_FILE_IO_BUFFER_SIZE);
 	fclose(kmerFile);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(n!=m_subgraph->size()){
 		cout<<"n="<<n<<" size="<<m_subgraph->size()<<endl;
 	}
@@ -124,7 +124,7 @@ void CoverageGatherer::writeKmers(){
 void CoverageGatherer::call_RAY_SLAVE_MODE_SEND_DISTRIBUTION(){
 
 	if(m_distributionOfCoverage.size()==0){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		LargeCount n=0;
 		#endif
 
@@ -143,12 +143,12 @@ void CoverageGatherer::call_RAY_SLAVE_MODE_SEND_DISTRIBUTION(){
 			CoverageDepth coverage=node->getCoverage(&key);
 			m_distributionOfCoverage[coverage]++;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			n++;
 			#endif
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(n!=m_subgraph->size()){
 			cout<<"Expected (from iterator)="<<n<<" Actual (->size())="<<m_subgraph->size()<<endl;
 		}
diff --git a/code/EdgePurger/EdgePurger.cpp b/code/EdgePurger/EdgePurger.cpp
index d7d02b3..0dd4f51 100644
--- a/code/EdgePurger/EdgePurger.cpp
+++ b/code/EdgePurger/EdgePurger.cpp
@@ -72,7 +72,7 @@ void EdgePurger::call_RAY_SLAVE_MODE_PURGE_NULL_EDGES(){
 		MessageUnit*buffer=message->getBuffer();
 		LargeCount numberOfVertices=buffer[0];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(source>=0);
 		assert(source<(int)m_graphSizes.size());
 		#endif
@@ -148,7 +148,7 @@ Worker* EdgePurger::assignNextTask(){
 	cout<<"EdgePurger::assignNextTask"<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_graphIterator.hasNext());
 	#endif
 
@@ -162,7 +162,7 @@ Worker* EdgePurger::assignNextTask(){
 
 	m_SEEDING_i++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(worker != NULL);
 	#endif
 
diff --git a/code/FusionData/FusionData.cpp b/code/FusionData/FusionData.cpp
index 855f29f..c3a7bba 100644
--- a/code/FusionData/FusionData.cpp
+++ b/code/FusionData/FusionData.cpp
@@ -70,7 +70,7 @@ void FusionData::processCheckpoints(){
 					path.push_back(&kmer);
 				}
 	
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(vertices!=0);
 				assert(vertices == (int)path.size());
 				#endif
@@ -126,7 +126,7 @@ void FusionData::call_RAY_SLAVE_MODE_DISTRIBUTE_FUSIONS(){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_seedingData->m_SEEDING_i<m_ed->m_EXTENSION_contigs.size());
 	assert(m_ed->m_EXTENSION_currentPosition < (int) m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i].size());
 	assert(m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i].size() > 0);
@@ -178,7 +178,7 @@ void FusionData::constructor(int size,int max,int rank,StaticVector*outbox,
 	m_outbox=outbox;
 	m_outboxAllocator=outboxAllocator;
 	m_wordSize=wordSize;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_wordSize>0);
 	#endif
 	
@@ -237,7 +237,7 @@ void FusionData::finishFusions(){
 		m_cacheForRepeatedVertices.clear();
 		m_cacheAllocator.clear();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_FINISH_pathsForPosition!=NULL);
 		#endif
 		delete m_FINISH_pathsForPosition;
@@ -277,7 +277,7 @@ void FusionData::finishFusions(){
 	
 	PathHandle currentId=m_ed->m_EXTENSION_identifiers[m_seedingData->m_SEEDING_i];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getRankFromPathUniqueId(currentId)<m_size);
 	#endif
 
@@ -458,7 +458,7 @@ void FusionData::finishFusions(){
 	}else if(!m_mappingConfirmed){
 		if(position1<=m_validationPosition && m_validationPosition<=position2){
 			if(!m_Machine_getPaths_DONE){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_seedingData->m_SEEDING_i<m_ed->m_EXTENSION_contigs.size());
 				assert(m_ed->m_EXTENSION_currentPosition<(int)m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i].size());
 				#endif
@@ -517,7 +517,7 @@ void FusionData::finishFusions(){
 				MessageUnit*message=(MessageUnit*)m_outboxAllocator->allocate(sizeof(MessageUnit));
 				message[0]=pathId.getValue();
 	
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(rankId<m_size);
 				#endif
 	
@@ -604,11 +604,11 @@ void FusionData::getPaths(Kmer vertex){
 	}
 	if(m_cacheForRepeatedVertices.find(vertex,false)!=NULL){
 		SplayNode<Kmer ,Direction*>*node=m_cacheForRepeatedVertices.find(vertex,false);
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(node!=NULL);
 		#endif
 		Direction**ddirect=node->getValue();
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(ddirect!=NULL);
 		#endif
 		Direction*d=*ddirect;
@@ -629,13 +629,13 @@ void FusionData::getPaths(Kmer vertex){
 		m_FUSION_paths_received=false;
 		m_FUSION_receivedPaths.clear();
 	}else if(m_FUSION_paths_received){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		for(int i=0;i<(int)m_FUSION_receivedPaths.size();i++){
 			assert(getRankFromPathUniqueId(m_FUSION_receivedPaths[i].getWave())<m_size);
 		}
 		#endif
 		// save the result in the cache.
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_cacheForRepeatedVertices.find(vertex,false)==NULL);
 		#endif
 
@@ -654,7 +654,7 @@ void FusionData::getPaths(Kmer vertex){
 		Direction**ddirect=node->getValue();
 		*ddirect=theDirection;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(m_Machine_getPaths_result.size()==0){
 			assert(*(m_cacheForRepeatedVertices.find(vertex,false)->getValue())==NULL);
 		}
diff --git a/code/FusionTaskCreator/FusionWorker.cpp b/code/FusionTaskCreator/FusionWorker.cpp
index 313fce0..a94c447 100644
--- a/code/FusionTaskCreator/FusionWorker.cpp
+++ b/code/FusionTaskCreator/FusionWorker.cpp
@@ -210,7 +210,7 @@ TODO: does the code pay attention when the coverage indicates a repeated k-mer ?
  * 			m_hitNames
  * 			m_hitLengths
  */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_hits.size()==m_hitLengths.size());
 		assert(m_hitLengths.size()==m_hitNames.size());
 		assert(m_hitIterator == (int)m_hitLengths.size());
@@ -227,7 +227,7 @@ TODO: does the code pay attention when the coverage indicates a repeated k-mer ?
 			int selfLength=m_path->size();
 			int matches=m_hits[hit];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(hit != m_identifier);
 			#endif
 
diff --git a/code/GeneOntology/GeneOntology.cpp b/code/GeneOntology/GeneOntology.cpp
index da7f38e..61a0ed5 100644
--- a/code/GeneOntology/GeneOntology.cpp
+++ b/code/GeneOntology/GeneOntology.cpp
@@ -97,7 +97,7 @@ string GeneOntology::getDomainName(GeneOntologyDomain handle){
 		m_domainNames[GENE_ONTOLOGY_DOMAIN_biological_process]=GENE_ONTOLOGY_DOMAIN_biological_process_STRING;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_domainNames.count(handle)==1);
 	#endif
 
@@ -112,7 +112,7 @@ GeneOntologyDomain GeneOntology::getGeneOntologyDomain(const char*text){
 		m_domains[GENE_ONTOLOGY_DOMAIN_biological_process_STRING]=GENE_ONTOLOGY_DOMAIN_biological_process;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_domains.count(text)>0);
 	#endif
 
@@ -161,7 +161,7 @@ void GeneOntology::fetchRelevantColors(){
 		Vertex*node=iterator.next();
 		Kmer key=*(iterator.getKey());
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parity==0 || parity==1);
 		#endif
 
@@ -183,6 +183,7 @@ void GeneOntology::fetchRelevantColors(){
 	
 			PhysicalKmerColor nameSpace=physicalColor/COLOR_NAMESPACE_MULTIPLIER;
 		
+			// for -gene-ontology
 			if(nameSpace==COLOR_NAMESPACE_EMBL_CDS){
 				PhysicalKmerColor colorForPhylogeny=physicalColor % COLOR_NAMESPACE_MULTIPLIER;
 
@@ -397,7 +398,7 @@ void GeneOntology::writeOntologyProfile(GeneOntologyDomain domain){
 		domainName=GENE_ONTOLOGY_DOMAIN_molecular_function_STRING;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(domainName!="NULL");
 	#endif
 
@@ -475,7 +476,7 @@ bool GeneOntology::hasDepth(GeneOntologyIdentifier handle){
 
 int GeneOntology::getGeneOntologyDepth(GeneOntologyIdentifier handle){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_depths.count(handle)==0){
 		cout<<"Error: handle "<<handle<<" identifier="<<getGeneOntologyIdentifier(handle)<<" has no depth"<<endl;
 	}
@@ -548,7 +549,7 @@ void GeneOntology::populateRecursiveValues(){
 
 void GeneOntology::addRecursiveCount(GeneOntologyIdentifier handle,int count){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_recursiveCounts.count(handle)==0);
 	#endif
 
@@ -556,7 +557,7 @@ void GeneOntology::addRecursiveCount(GeneOntologyIdentifier handle,int count){
 }
 
 int GeneOntology::getRecursiveCount(GeneOntologyIdentifier handle){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_recursiveCounts.count(handle)==1);
 	#endif
 
@@ -730,7 +731,7 @@ void GeneOntology::writeOntologyFiles(){
 			mean/=total;
 		}
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(modeCoverages.count(handle)==0);
 		assert(meanCoverages.count(handle)==0);
 		#endif /**/
@@ -856,7 +857,7 @@ void GeneOntology::writeOntologyFiles(){
 
 void GeneOntology::setDomain(GeneOntologyIdentifier handle,GeneOntologyDomain domain){
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_termDomains.count(handle)==0);
 	#endif
 
@@ -873,7 +874,7 @@ GeneOntologyDomain GeneOntology::getDomain(GeneOntologyIdentifier handle){
 		return GENE_ONTOLOGY_DOMAIN_molecular_function;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_termDomains.count(handle)==0){
 		cout<<"Error, handle= "<<handle<<" termDomains: "<<m_termDomains.size()<<endl;
 	}
@@ -942,7 +943,7 @@ void GeneOntology::loadOntology(map<GeneOntologyIdentifier,string>*identifiers,
 
 			GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str());
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(identifiers->count(handle)==0);
 			assert(descriptions->count(handle)==0);
 			#endif
@@ -977,7 +978,7 @@ void GeneOntology::loadOntology(map<GeneOntologyIdentifier,string>*identifiers,
 			GeneOntologyIdentifier handle=encoder.encodeGeneOntologyHandle(identifier.c_str());
 
 			// an alternate handle can be utilised only once
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_symbolicLinks.count(alternateHandle)==0);
 			#endif
 
@@ -1002,7 +1003,7 @@ void GeneOntology::loadOntology(map<GeneOntologyIdentifier,string>*identifiers,
 
 	cout<<"Rank "<<m_rank<<": loaded "<<identifiers->size()<<" gene ontology terms."<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(identifiers->size()==descriptions->size());
 	#endif
 
@@ -1078,7 +1079,7 @@ void GeneOntology::getPathsFromRoot(GeneOntologyIdentifier handle,vector<vector<
 
 void GeneOntology::addParentGeneOntologyIdentifier(GeneOntologyIdentifier term,GeneOntologyIdentifier parent){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(hasParent(term)){
 		vector<GeneOntologyIdentifier> parents;
 		getParents(term,&parents);
@@ -1096,7 +1097,7 @@ void GeneOntology::addParentGeneOntologyIdentifier(GeneOntologyIdentifier term,G
 
 void GeneOntology::getChildren(GeneOntologyIdentifier handle,vector<GeneOntologyIdentifier>*children){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(children->size()==0);
 	#endif
 
@@ -1112,7 +1113,7 @@ void GeneOntology::getChildren(GeneOntologyIdentifier handle,vector<GeneOntology
 
 void GeneOntology::getParents(GeneOntologyIdentifier handle,vector<GeneOntologyIdentifier>*parents){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(parents->size()==0);
 	#endif
 
@@ -1178,7 +1179,7 @@ void GeneOntology::synchronize(){
 
 		MessageUnit*buffer=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(buffer!=NULL);
 		#endif
 
@@ -1193,7 +1194,7 @@ void GeneOntology::synchronize(){
 			cout<<"[DEBUG_ONTOLOGY_SYNC] will add an object."<<endl;
 			#endif
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(added==0){
 				assert(bufferPosition==0);
 			}
@@ -1201,7 +1202,7 @@ void GeneOntology::synchronize(){
 				
 			addDataToBuffer(buffer,&bufferPosition);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(bufferPosition%3 == 0);
 			#endif
 
@@ -1287,7 +1288,7 @@ void GeneOntology::countOntologyTermsInGraph(){
 
 	cout<<"Rank "<<m_rank<<": counting ontology terms in the graph..."<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ontologyTermFrequencies.size()==0);
 	#endif
 
@@ -1304,7 +1305,7 @@ void GeneOntology::countOntologyTermsInGraph(){
 		Vertex*node=iterator.next();
 		Kmer key=*(iterator.getKey());
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parity==0 || parity==1);
 		#endif
 
@@ -1419,7 +1420,7 @@ GeneOntologyIdentifier GeneOntology::dereferenceTerm_safe(GeneOntologyIdentifier
 
 void GeneOntology::incrementOntologyTermFrequency(GeneOntologyIdentifier term,CoverageDepth kmerCoverage,int frequency){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(kmerCoverage>0);
 	assert(frequency>0);
 
@@ -1430,7 +1431,7 @@ void GeneOntology::incrementOntologyTermFrequency(GeneOntologyIdentifier term,Co
 
 	m_ontologyTermFrequencies[term][kmerCoverage]+=frequency;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ontologyTermFrequencies.count(term)>0);
 	assert(m_ontologyTermFrequencies[term].count(kmerCoverage)>0);
 	#endif
diff --git a/code/GeneOntology/KeyEncoder.cpp b/code/GeneOntology/KeyEncoder.cpp
index 765dfd2..de6d893 100644
--- a/code/GeneOntology/KeyEncoder.cpp
+++ b/code/GeneOntology/KeyEncoder.cpp
@@ -27,7 +27,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -82,7 +82,7 @@ PhysicalKmerColor KeyEncoder::encode_EMBL_CDS(const char*identifier){
 
 	PhysicalKmerColor returnValue=0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(strlen(identifier)==3+5);
 	#endif
 
@@ -91,7 +91,7 @@ PhysicalKmerColor KeyEncoder::encode_EMBL_CDS(const char*identifier){
 	for(int exponent=0;exponent<5;exponent++){
 		char symbol=identifier[7-exponent];
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_mapping.count(symbol)>0);
 		#endif
 
@@ -113,7 +113,7 @@ PhysicalKmerColor KeyEncoder::encode_EMBL_CDS(const char*identifier){
 	for(int exponent=0;exponent<3;exponent++){
 		char symbol=identifier[2-exponent];
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_mapping.count(symbol)>0);
 		#endif
 
@@ -192,7 +192,7 @@ GeneOntologyIdentifier KeyEncoder::encodeGeneOntologyHandle(const char*identifie
 	
 	populateMap();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_mapping.size()>0);
 	#endif
 
@@ -210,7 +210,7 @@ GeneOntologyIdentifier KeyEncoder::encodeGeneOntologyHandle(const char*identifie
 		return 0;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((int)strlen(identifier)== (start+length));
 	#endif
 
@@ -219,7 +219,7 @@ GeneOntologyIdentifier KeyEncoder::encodeGeneOntologyHandle(const char*identifie
 
 		char symbol=identifier[total-1-i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(m_mapping.count(symbol)==0){
 			cout<<"Error: <input>"<<identifier<<"</input>"<<" symbol is "<<symbol<<endl;
 		}
diff --git a/code/GenomeNeighbourhood/GenomeNeighbourhood.cpp b/code/GenomeNeighbourhood/GenomeNeighbourhood.cpp
index c8aaece..49e5ced 100644
--- a/code/GenomeNeighbourhood/GenomeNeighbourhood.cpp
+++ b/code/GenomeNeighbourhood/GenomeNeighbourhood.cpp
@@ -28,7 +28,7 @@
 #include "GenomeNeighbourhood.h"
 
 #include <sstream>
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -64,7 +64,7 @@ void GenomeNeighbourhood::call_RAY_MPI_TAG_NEIGHBOURHOOD_DATA(Message*message){
 
 	int gapSizeInKmers=incoming[position++];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(gapSizeInKmers >= 1);
 	assert(m_rank==0x00);
 	assert(m_contigLengths->count(leftContig)>0);
@@ -285,7 +285,7 @@ void GenomeNeighbourhood::fetchPaths(int mode){
 
 void GenomeNeighbourhood::processLinks(int mode){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!m_stackOfVertices.empty());
 	assert(m_stackOfVertices.size() == m_stackOfDepths.size());
 	#endif
@@ -382,13 +382,13 @@ void GenomeNeighbourhood::processLinks(int mode){
 		vector<MessageUnit> elements;
 		m_virtualCommunicator->getMessageResponseElements(m_workerId,&elements);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert((int)elements.size()>=2);
 		#endif
 
 		uint8_t edges=elements[0];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		int coverage=elements[1];
 		assert(coverage>0);
 		#endif
@@ -412,7 +412,7 @@ void GenomeNeighbourhood::processLinks(int mode){
 		
 		vector<Kmer>*links=&parents;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(mode==FETCH_CHILDREN || mode==FETCH_PARENTS);
 		#endif
 
@@ -423,7 +423,7 @@ void GenomeNeighbourhood::processLinks(int mode){
 			links=&parents;
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_stackOfDepths.size()==m_stackOfVertices.size());
 		#endif
 
@@ -431,7 +431,7 @@ void GenomeNeighbourhood::processLinks(int mode){
 
 		for(int i=0;i<(int)links->size();i++){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(i<(int) links->size());
 			#endif
 
@@ -459,19 +459,19 @@ void GenomeNeighbourhood::processLinks(int mode){
 
 void GenomeNeighbourhood::processSide(int mode){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(mode==FETCH_CHILDREN || mode==FETCH_PARENTS);
 	#endif
 
 	if(!m_startedSide){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_contigIndex < (int)m_contigs->size());
 		#endif
 
 		int contigLength=m_contigs->at(m_contigIndex).size();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(contigLength>=1);
 		#endif
 
@@ -902,7 +902,7 @@ void GenomeNeighbourhood::call_RAY_SLAVE_MODE_NEIGHBOURHOOD(){
 
 		cout<<"Rank "<<m_rank<<" is fetching contig path neighbours ["<<m_contigIndex<<"/"<<m_contigs->size()<<"]"<<endl;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_contigIndex == (int)m_contigs->size());
 		#endif
 
@@ -925,7 +925,7 @@ void GenomeNeighbourhood::sendRightNeighbours(){
 			Rank destination=0x0;
 			int period=m_virtualCommunicator->getElementsPerQuery(RAY_MPI_TAG_NEIGHBOURHOOD_DATA);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(period > 0);
 			#endif
 
@@ -985,7 +985,7 @@ void GenomeNeighbourhood::sendLeftNeighbours(){
 			Rank destination=0x0;
 			int period=m_virtualCommunicator->getElementsPerQuery(RAY_MPI_TAG_NEIGHBOURHOOD_DATA);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(period > 0);
 			#endif
 
diff --git a/code/JoinerTaskCreator/JoinerWorker.cpp b/code/JoinerTaskCreator/JoinerWorker.cpp
index 081ebd9..ba26e36 100644
--- a/code/JoinerTaskCreator/JoinerWorker.cpp
+++ b/code/JoinerTaskCreator/JoinerWorker.cpp
@@ -60,7 +60,7 @@ void JoinerWorker::work(){
 			}
 */
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_position < (int)m_path->size());
 			#endif
 
@@ -73,7 +73,7 @@ void JoinerWorker::work(){
 			int destination=kmer.vertexRank(m_parameters->getSize(),
 				m_parameters->getWordSize(),m_parameters->getColorSpaceMode());
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(destination < m_parameters->getSize() && destination >= 0);
 			#endif
 
@@ -247,7 +247,7 @@ void JoinerWorker::work(){
  * 			m_hitNames
  * 			m_hitLengths
  */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_hits.size()==m_hitLengths.size());
 		assert(m_hitLengths.size()==m_hitNames.size());
 		assert(m_hitIterator == (int)m_hitLengths.size());
@@ -255,7 +255,7 @@ void JoinerWorker::work(){
 
 		// here, populate coordinates
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_selfPositions.size()==m_hitPositions.size());
 		#endif
 
@@ -380,7 +380,7 @@ void JoinerWorker::work(){
 		m_selfPositions.clear();
 		m_hitPositions.clear();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_selfPositions.size()==m_hitPositions.size());
 		assert(m_selfPositions.size()==0);
 		#endif
@@ -399,13 +399,13 @@ void JoinerWorker::work(){
 			//int selfLength=m_path->size();
 
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_hits.count(hit)>0);
 			#endif
 
 			int matches=m_hits[hit];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(hit != m_identifier);
 			#endif
 
@@ -596,7 +596,7 @@ Also, don't do it if the matching ratios are below 10%.
 				cout<<" End: "<<m_maxPosition[hitName]<<endl;
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(hitLength == (int)m_hitVertices.size());
 			#endif
 
diff --git a/code/KmerAcademyBuilder/BloomFilter.cpp b/code/KmerAcademyBuilder/BloomFilter.cpp
index 613bc08..9c30cb6 100644
--- a/code/KmerAcademyBuilder/BloomFilter.cpp
+++ b/code/KmerAcademyBuilder/BloomFilter.cpp
@@ -25,7 +25,7 @@
 #include <RayPlatform/memory/allocator.h>
 
 #include <iostream>
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 using namespace std;
@@ -47,7 +47,7 @@ false positive rate = 0.00846 = 0.846%
 
 	m_bits=numberOfBits; /* 500 000 000 */
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(numberOfBits>0);
 	#endif
 
@@ -78,7 +78,7 @@ ULL means unsigned long long, it is necessary on some architectures
 	m_hashNumbers[m_hashFunctions++]=0x9007d0caef749698ULL;
 	m_hashNumbers[m_hashFunctions++]=0x4e4100a5605ef967ULL;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_hashFunctions == 8);
 	#endif
 
@@ -108,7 +108,7 @@ ULL means unsigned long long, it is necessary on some architectures
 
 #endif /* CONFIG_VERBOSE_BLOOM_FILTER */
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(required8Bytes > 0);
 	assert(m_bitmap != NULL);
 	#endif
@@ -132,7 +132,7 @@ bool BloomFilter::hasValue(Kmer*kmer){
 		int bitInChunk=bit%64;
 		int bitValue=(m_bitmap[chunk] << (63-bitInChunk)) >> 63;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bitValue == 0 || bitValue == 1);
 		#endif
 
@@ -140,7 +140,7 @@ bool BloomFilter::hasValue(Kmer*kmer){
 		if(bitValue == 0)
 			return false;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bitValue == 1);
 		#endif
 	}
@@ -153,7 +153,7 @@ void BloomFilter::insertValue(Kmer*kmer){
 
 	uint64_t origin = kmer->hash_function_2();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_hashFunctions == 8);
 	#endif
 
@@ -179,7 +179,7 @@ void BloomFilter::insertValue(Kmer*kmer){
 
 		m_bitmap[chunk] |= filter;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		int bitValue=(m_bitmap[chunk] << (63-bitInChunk)) >> 63;
 		if(bitValue != 1)
 			cout<<"Fatal: bit is "<<bitValue<<" but should be 1 bit="<<bit<<" chunk="<<chunk<<" bitInChunk="<<bitInChunk<<" chunkContent="<<m_bitmap[chunk]<<" filter="<<filter<<endl;
@@ -192,7 +192,7 @@ void BloomFilter::insertValue(Kmer*kmer){
 		m_numberOfSetBits++;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasValue(kmer));
 	#endif
 
@@ -201,7 +201,7 @@ void BloomFilter::insertValue(Kmer*kmer){
 
 void BloomFilter::destructor(){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_bitmap != NULL);
 	assert(m_hashFunctions > 0);
 	assert(m_bits > 0);
@@ -212,7 +212,7 @@ void BloomFilter::destructor(){
 	m_bits=0;
 	m_hashFunctions=0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_bitmap == NULL);
 	#endif
 }
diff --git a/code/KmerAcademyBuilder/Kmer.h b/code/KmerAcademyBuilder/Kmer.h
index 68a56c7..dacb286 100644
--- a/code/KmerAcademyBuilder/Kmer.h
+++ b/code/KmerAcademyBuilder/Kmer.h
@@ -33,7 +33,7 @@
 /* this header was missing, but the code compiled with clang++, gcc, intel, pgi, but not pathscale. pathscale was right */
 #include <fstream> 
 #include <vector>
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 #include <string>
diff --git a/code/KmerAcademyBuilder/KmerAcademyBuilder.cpp b/code/KmerAcademyBuilder/KmerAcademyBuilder.cpp
index cb394ae..5dbf468 100644
--- a/code/KmerAcademyBuilder/KmerAcademyBuilder.cpp
+++ b/code/KmerAcademyBuilder/KmerAcademyBuilder.cpp
@@ -63,7 +63,7 @@ void KmerAcademyBuilder::call_RAY_SLAVE_MODE_ADD_VERTICES(){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pendingMessages>=0);
 	#endif
 	if(m_inbox->size()>0&&m_inbox->at(0)->getTag()==RAY_MPI_TAG_VERTICES_DATA_REPLY){
@@ -98,7 +98,7 @@ void KmerAcademyBuilder::call_RAY_SLAVE_MODE_ADD_VERTICES(){
 		// flush data
 		flushAll(m_outboxAllocator,m_outbox,m_parameters->getRank());
 		if(m_pendingMessages==0){
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_bufferedData.isEmpty());
 			#endif
 
@@ -136,7 +136,7 @@ void KmerAcademyBuilder::call_RAY_SLAVE_MODE_ADD_VERTICES(){
 		char memory[CONFIG_MAXKMERLENGTH+1];
 		int maximumPosition=len-m_parameters->getWordSize()+1;
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_readSequence!=NULL);
 		#endif
 
@@ -246,7 +246,7 @@ SlaveMode*mode,RingAllocator*outboxAllocator){
 }
 
 void KmerAcademyBuilder::setReadiness(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pendingMessages>0);
 	#endif
 	m_pendingMessages--;
@@ -274,7 +274,7 @@ void KmerAcademyBuilder::incrementPendingMessages(){
 }
 
 void KmerAcademyBuilder::showBuffers(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_bufferedData.isEmpty());
 	#endif
 }
diff --git a/code/Library/Library.cpp b/code/Library/Library.cpp
index ebd0aed..b1a7951 100644
--- a/code/Library/Library.cpp
+++ b/code/Library/Library.cpp
@@ -251,7 +251,7 @@ void Library::call_RAY_SLAVE_MODE_AUTOMATIC_DISTANCE_DETECTION(){
 	if(m_activeWorkerIterator!=m_activeWorkers.end()){
 		WorkerHandle workerId=*m_activeWorkerIterator;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(m_aliveWorkers.count(workerId)==0){
 			cout<<"Error: "<<workerId<<" is not in alive workers "<<m_activeWorkers.size()<<endl;
 		}
@@ -286,7 +286,7 @@ void Library::call_RAY_SLAVE_MODE_AUTOMATIC_DISTANCE_DETECTION(){
 			if(m_SEEDING_i<m_seedingData->m_SEEDING_seeds.size()
 				&&(int)m_aliveWorkers.size()<m_maximumAliveWorkers){
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_SEEDING_i==0){
 					assert(m_completedJobs==0&&m_activeWorkers.size()==0&&m_aliveWorkers.size()==0);
 				}
@@ -339,7 +339,7 @@ void Library::call_RAY_SLAVE_MODE_AUTOMATIC_DISTANCE_DETECTION(){
 		m_activeWorkerIterator=m_activeWorkers.begin();
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((int)m_aliveWorkers.size()<=m_maximumAliveWorkers);
 	#endif
 
@@ -431,7 +431,7 @@ Parameters*m_parameters,SeedingData*m_seedingData,StaticVector*inbox,VirtualComm
 	m_ranksThatReplied=0;
 	this->m_outbox=m_outbox;
 	this->m_outboxAllocator=m_outboxAllocator;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(this->m_outboxAllocator!=NULL);
 	#endif
 	this->m_ed=m_ed;
@@ -523,7 +523,7 @@ void Library::updateStates(){
 	for(int i=0;i<(int)m_workersDone.size();i++){
 		WorkerHandle workerId=m_workersDone[i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		assert(m_aliveWorkers.count(workerId)>0);
 		#endif
@@ -542,7 +542,7 @@ void Library::updateStates(){
 	for(int i=0;i<(int)m_waitingWorkers.size();i++){
 		WorkerHandle workerId=m_waitingWorkers[i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		#endif
 
diff --git a/code/Library/LibraryWorker.cpp b/code/Library/LibraryWorker.cpp
index f8257c3..e1bbcba 100644
--- a/code/Library/LibraryWorker.cpp
+++ b/code/Library/LibraryWorker.cpp
@@ -67,7 +67,7 @@ void LibraryWorker::work(){
 	if(m_done){
 		return;
 	}
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_SEEDING_i<m_seedingData->m_SEEDING_seeds.size());
 	#endif
 	if(m_EXTENSION_currentPosition==(int)m_seedingData->m_SEEDING_seeds[m_SEEDING_i].size()){
@@ -80,7 +80,7 @@ void LibraryWorker::work(){
 	}else{
 		if(!m_EXTENSION_reads_requested){
 			m_EXTENSION_reads_requested=true;
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_seedingData!=NULL);
 			assert(m_EXTENSION_currentPosition<(int)m_seedingData->m_SEEDING_seeds[m_SEEDING_i].size());
 			#endif
@@ -91,7 +91,7 @@ void LibraryWorker::work(){
 		
 			m_readFetcher.constructor(vertex,m_outboxAllocator,m_inbox,m_outbox,m_parameters,m_virtualCommunicator,
 				m_SEEDING_i,RAY_MPI_TAG_REQUEST_VERTEX_READS);
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(!m_readFetcher.isDone());
 			#endif
 			m_EXTENSION_edgeIterator=0;// iterate over reads
@@ -105,7 +105,7 @@ void LibraryWorker::work(){
 				if(!m_EXTENSION_hasPairedReadRequested){
 					MessageUnit*message=(MessageUnit*)(m_outboxAllocator)->allocate(1*sizeof(MessageUnit));
 					message[0]=rightRead;
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(m_parameters!=NULL);
 					if(!(annotation.getRank()<m_parameters->getSize())){
 						cout<<"Error rank="<<annotation.getRank()<<" size="<<m_parameters->getSize()<<endl;
@@ -118,7 +118,7 @@ void LibraryWorker::work(){
 				}else if(m_virtualCommunicator->isMessageProcessed(m_SEEDING_i)){
 					vector<MessageUnit> buffer;
 					m_virtualCommunicator->getMessageResponseElements(m_SEEDING_i,&buffer);
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert((int)buffer.size()==4);
 					#endif
 	
diff --git a/code/MachineHelper/MachineHelper.cpp b/code/MachineHelper/MachineHelper.cpp
index 459d4ac..356986a 100644
--- a/code/MachineHelper/MachineHelper.cpp
+++ b/code/MachineHelper/MachineHelper.cpp
@@ -33,7 +33,7 @@
 #include <sstream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -83,7 +83,7 @@ void MachineHelper::call_RAY_MPI_TAG_EXTENSION_DATA_END(Message*message){
  */
 void MachineHelper::call_RAY_MASTER_MODE_LOAD_CONFIG(){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(this!=NULL);
 	#endif
 
@@ -485,7 +485,9 @@ void MachineHelper::call_RAY_MASTER_MODE_WRITE_KMERS(){
 			}
 		}
 		m_numberOfRanksDone++;
+
 	}else if(m_numberOfRanksDone==m_parameters->getSize()){
+
 		if(m_parameters->writeKmers()){
 			cout<<endl;
 			cout<<"Rank "<<getRank()<<" wrote "<<m_parameters->getPrefix()<<"kmers.txt"<<endl;
@@ -516,6 +518,19 @@ void MachineHelper::call_RAY_MASTER_MODE_WRITE_KMERS(){
 		f.close();
 		cout<<"Rank "<<getRank()<<" wrote "<<edgeFile.str()<<endl;
 
+		// stop here (in parallel) if -graph-only is provided.
+		if(m_parameters->hasOption("-graph-only")){
+
+			cout << "Rank " << m_parameters->getRank();
+			cout << " option -graph-only detected,";
+			cout << " exiting when graph is ready.";
+			cout << endl;
+
+			m_switchMan->setMasterMode(RAY_MASTER_MODE_KILL_ALL_MPI_RANKS);
+			return;
+		}
+
+
 	}else if(m_coverageRank==m_numberOfRanksDone){
 
 		if(m_parameters->writeKmers()){
diff --git a/code/MessageProcessor/MessageProcessor.cpp b/code/MessageProcessor/MessageProcessor.cpp
index da74e9c..224175b 100644
--- a/code/MessageProcessor/MessageProcessor.cpp
+++ b/code/MessageProcessor/MessageProcessor.cpp
@@ -205,7 +205,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_READ_MARKERS(Message*message){
 	int outputPosition=0;
 	for(int i=0;i<count;i++){
 		int readId=incoming[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(readId>=(int)m_myReads->size())
 			cout<<"Fatal Error: ReadIndex: "<<readId<<" but Reads: "<<m_myReads->size()<<endl;
 		assert(readId<(int)m_myReads->size());
@@ -289,7 +289,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_READS(Message*message){
 	int OFFSET_POSITION_ON_STRAND=offset++;
 	int OFFSET_STRAND=offset++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(OFFSET_STRAND < period);
 	assert(message->getCount()%period ==0);
 	#endif
@@ -301,7 +301,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_READS(Message*message){
 	}
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(period>=5);
 	#endif
 
@@ -317,7 +317,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_READS(Message*message){
 		uint64_t integerValue=buffer[bufferPosition++];
 		unpack_pointer((void**)&ptr, integerValue);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		// check the padding
 
 		int start=KMER_U64_ARRAY_SIZE+1;
@@ -355,7 +355,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_READS(Message*message){
 
 			int rank=ptr->getRank();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(rank>=0&&rank<m_parameters->getSize());
 			#endif
 
@@ -432,7 +432,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTEX_READS(Message*message){
 	ReadAnnotation*e=(ReadAnnotation*)incoming[pos++];
 	ReadAnnotation*origin=e;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(e!=NULL);
 	#endif
 
@@ -476,7 +476,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTEX_INFO(Message*message){
 	bool lower=vertex<complement;
 	Vertex*node=m_subgraph->find(&vertex);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(node!=NULL);
 	#endif
 
@@ -560,7 +560,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTEX_READS_FROM_LIST(Message*message){
 	int numberOfMates=incoming[KMER_U64_ARRAY_SIZE+1];
 	bool lower=vertex<complement;
 	ReadAnnotation*e=(ReadAnnotation*)incoming[KMER_U64_ARRAY_SIZE+0];
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(e!=NULL);
 	#endif
 	MessageUnit*outgoingMessage=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
@@ -630,7 +630,7 @@ void MessageProcessor::call_RAY_MPI_TAG_START_INDEXING_SEQUENCES(Message*message
 				tmp->addOutgoingEdge(&kmer,&child,m_parameters->getWordSize());
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			vector<Kmer> parentKmers=tmp->getIngoingEdges(&kmer,m_parameters->getWordSize());
 			vector<Kmer> childKmers=tmp->getOutgoingEdges(&kmer,m_parameters->getWordSize());
 			if((int)parentKmers.size()!=parents){
@@ -646,7 +646,7 @@ void MessageProcessor::call_RAY_MPI_TAG_START_INDEXING_SEQUENCES(Message*message
 		/* Otherwise, the code will fail later on */
 		m_subgraph->completeResizing();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_subgraph->size()==n);
 		#endif
 
@@ -702,7 +702,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTICES_DATA(Message*message){
 /* make sure that the payload
  * is for this process and not another one...
  */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		Rank rankToFlush=kmerObject.vertexRank(m_parameters->getSize(),m_parameters->getWordSize(),
 			m_parameters->getColorSpaceMode());
 
@@ -727,7 +727,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTICES_DATA(Message*message){
  * the source code to enable odd k-mer length
  * values
  */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(reverseComplement!=kmerObject);
 		#endif
 
@@ -766,7 +766,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTICES_DATA(Message*message){
  */
 		Vertex*tmp=m_subgraph->insert(&kmerObject);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(tmp!=NULL);
 		#endif
 
@@ -811,7 +811,7 @@ void MessageProcessor::call_RAY_MPI_TAG_VERTICES_DATA(Message*message){
 void MessageProcessor::call_RAY_MPI_TAG_PURGE_NULL_EDGES(Message*message){
 
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	GridTableIterator iterator;
 	iterator.constructor(m_subgraph, m_parameters->getWordSize(),m_parameters);
 
@@ -941,7 +941,7 @@ void MessageProcessor::call_RAY_MPI_TAG_IN_EDGES_DATA(Message*message){
  * Make sure that the edge was added.
  */
 //#define ASSERT_123
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		vector<Kmer> inEdges=node->getIngoingEdges(&suffix,m_parameters->getWordSize());
 		bool found=false;
 		for(int j=0;j<(int)inEdges.size();j++){
@@ -989,7 +989,7 @@ void MessageProcessor::call_RAY_MPI_TAG_PREPARE_COVERAGE_DISTRIBUTION(Message*me
 		uint64_t setBits=m_bloomFilter.getNumberOfSetBits();
 		uint64_t bits=m_bloomFilter.getNumberOfBits();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bits>0);
 		assert(bits==m_bloomBits);
 		#endif
@@ -1120,7 +1120,7 @@ void MessageProcessor::call_RAY_MPI_TAG_START_SEEDING(Message*message){
 				ReadAnnotation*marker=
 					(ReadAnnotation*)m_si->getAllocator()->allocate(sizeof(ReadAnnotation));
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(marker!=NULL);
 				#endif
 
@@ -1128,7 +1128,7 @@ void MessageProcessor::call_RAY_MPI_TAG_START_SEEDING(Message*message){
 
 				Vertex*node=m_subgraph->find(&kmer);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(node==NULL){
 					cout<<"Not found: "<<kmer.idToWord(m_parameters->getWordSize(),
 						m_parameters->getColorSpaceMode())<<endl;
@@ -1187,7 +1187,7 @@ void MessageProcessor::call_RAY_MPI_TAG_START_SEEDING(Message*message){
 		cout<<"Rank "<<m_parameters->getRank()<<": memory usage for  optimal read markers= "<<allocatedBytes/1024<<" KiB"<<endl;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_subgraph!=NULL);
 	#endif
 }
@@ -1201,7 +1201,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_COVERAGE_AND_MARK(Message*message){
 	vertex.unpack(incoming,&bufferPosition);
 	Vertex*node=m_subgraph->find(&vertex);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(node!=NULL);
 	#endif
 
@@ -1243,7 +1243,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE(Message*message)
 		if(node!=NULL){
 			coverage=node->getCoverage(&vertex);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(coverage!=0);
 			#endif
 		}
@@ -1259,7 +1259,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE_REPLY(Message*me
 	void*buffer=message->getBuffer();
 	MessageUnit*incoming=(MessageUnit*)buffer;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	#endif
 
 	(m_seedingData->m_SEEDING_receivedVertexCoverage)=incoming[0];
@@ -1304,7 +1304,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_EDGES(Message*message){
 
 	Vertex*node=m_subgraph->find(&vertex);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(node!=NULL);
 	#endif
 
@@ -1430,7 +1430,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_INGOING_EDGES(Message*mes
 	MessageUnit*incoming=(MessageUnit*)buffer;
 	int count=message->getCount();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(count*5*sizeof(MessageUnit)>MAXIMUM_MESSAGE_SIZE_IN_BYTES){
 		cout<<"Count="<<count<<endl;
 	}
@@ -1443,7 +1443,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_VERTEX_INGOING_EDGES(Message*mes
 		int pos=i;
 		vertex.unpack(incoming,&pos);
 		Vertex*node=m_subgraph->find(&vertex);
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(node==NULL){
 			cout<<"Rank="<<m_rank<<" "<<vertex.idToWord(m_parameters->getWordSize(),
 					m_parameters->getColorSpaceMode())<<" does not exist."<<endl;
@@ -1546,7 +1546,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ATTACH_SEQUENCE(Message*message){
 
 		ReadAnnotation*e=(ReadAnnotation*)m_si->getAllocator()->allocate(sizeof(ReadAnnotation));
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(e!=NULL);
 		#endif
 		e->constructor(rank,sequenceIdOnDestination,positionOnStrand,strand,lower);
@@ -1588,11 +1588,11 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_READ_LENGTH(Message*message){
 	Rank source=message->getSource();
 	MessageUnit*incoming=(MessageUnit*)buffer;
 	int index=incoming[0];
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(index<(int)m_myReads->size());
 	#endif
 	Read*read=(*m_myReads)[index];
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(read!=NULL);
 	#endif
 	int length=read->length();
@@ -1654,7 +1654,7 @@ void MessageProcessor::call_RAY_MPI_TAG_SAVE_WAVE_PROGRESSION(Message*message){
 		Kmer rc=m_parameters->_complementVertex(&vertex);
 		bool lower=vertex<rc;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		Vertex*node=m_subgraph->find(&vertex);
 		if(node==NULL){
 			cout<<"Error: vertex does not exist: "<<vertex.idToWord(m_parameters->getWordSize(),
@@ -1669,7 +1669,7 @@ void MessageProcessor::call_RAY_MPI_TAG_SAVE_WAVE_PROGRESSION(Message*message){
 
 		PathHandle wave=incoming[pos++];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(getRankFromPathUniqueId(wave)>=m_size){
 			cout<<"Invalid rank: "<<getRankFromPathUniqueId(wave)<<" maximum is "<<m_size-1<<endl;
 		}
@@ -1745,7 +1745,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATHS_SIZE(Message*message){
 		Kmer vertex;
 		vertex.unpack(incoming,&pos);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		Vertex*node=m_subgraph->find(&vertex);
 		if(node==NULL){
 			cout<<"Source="<<message->getSource()<<" Destination="<<m_rank<<" "<<vertex.idToWord(m_parameters->getWordSize(),
@@ -1788,7 +1788,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_PATH_LENGTH(Message*message){
 
 		if(m_fusionData->m_FUSION_identifier_map.count(id)>0){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_fusionData->m_FUSION_identifier_map[id] < (int) m_ed->m_EXTENSION_contigs.size());
 			#endif
 
@@ -1871,14 +1871,14 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATHS(Message*message){
 	outputPosition++;
 
 	while(firstPathId<(int)paths.size() && (outputPosition+2)<availableElements){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(firstPathId<(int)paths.size());
 		#endif
 
 		PathHandle pathId=paths[firstPathId].getWave().getValue();
 		int progression=paths[firstPathId].getProgression();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(getRankFromPathUniqueId(pathId)>=m_size){
 			cout<<"Invalid rank: "<<getRankFromPathUniqueId(pathId)<<" maximum is "<<m_size-1<<" Index: "<<firstPathId<<" Total: "<<paths.size()<<" Progression: "<<progression<<endl;
 		}
@@ -1892,7 +1892,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATHS(Message*message){
 
 	message2[origin]=firstPathId;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(outputPosition<=availableElements);
 	assert(source<m_size);
 	#endif
@@ -1919,7 +1919,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATHS_REPLY(Message*message){
 	pos++;
 	for(int i=pos;i<count;i+=2){
 		PathHandle pathId=incoming[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(getRankFromPathUniqueId(pathId)<m_size);
 		#endif
 		int position=incoming[i+1];
@@ -1947,7 +1947,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATHS_REPLY_END(Message*messa
 	bool lower=vertex<complement;
 	for(int i=bufferPosition;i<count;i+=2){
 		PathHandle pathId=incoming[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(getRankFromPathUniqueId(pathId)<m_size);
 		#endif
 		int position=incoming[i+1];
@@ -1968,7 +1968,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATH(Message*message){
 	int outputPosition=0;
 	MessageUnit*message2=(MessageUnit*)m_outboxAllocator->allocate(count*sizeof(MessageUnit));
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count % elementsPerItem == 0);
 	#endif
 
@@ -1976,7 +1976,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATH(Message*message){
 		Kmer kmer;
 		kmer.unpack(incoming,&pos);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		Vertex*node=m_subgraph->find(&kmer);
 		assert(node!=NULL);
 		#endif
@@ -1987,7 +1987,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATH(Message*message){
 		/* increment because there is padding */
 		pos++;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(indexInArray<(int)paths.size());
 		#endif
 
@@ -1995,7 +1995,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATH(Message*message){
 		kmer.pack(message2,&outputPosition);
 		message2[outputPosition++]=d.getWave().getValue();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		Rank rank=getRankFromPathUniqueId(d.getWave());
 		if(rank>=m_size){
 			cout<<"Fatal error: rank: "<<rank<<endl;
@@ -2021,7 +2021,7 @@ void MessageProcessor::call_RAY_MPI_TAG_ASK_VERTEX_PATH_REPLY(Message*message){
 	bool lower=vertex<complement;
 	MessageUnit pathId=incoming[pos];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getRankFromPathUniqueId(pathId)<m_size);
 	#endif
 
@@ -2037,7 +2037,7 @@ void MessageProcessor::call_RAY_MPI_TAG_HAS_PAIRED_READ(Message*message){
 	int count=message->getCount();
 	for(int i=0;i<count;i++){
 		int index=incoming[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(index<(int)m_myReads->size());
 		#endif
 		message2[i]=(*m_myReads)[index]->hasPairedRead();
@@ -2059,7 +2059,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_PAIRED_READ(Message*message){
 	MessageUnit*incoming=(MessageUnit*)buffer;
 	int index=incoming[0];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(index<(int)m_myReads->size());
 	#endif
 
@@ -2070,7 +2070,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_PAIRED_READ(Message*message){
 		t=&dummy;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(t!=NULL);
 	#endif
 
@@ -2100,7 +2100,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 	// clearing old data too!.
 	m_fusionData->m_FINISH_pathLengths.clear();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ed->m_EXTENSION_contigs.size()==m_ed->m_EXTENSION_identifiers.size());
 	#endif
 
@@ -2108,7 +2108,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 	GridTableIterator iterator;
 	iterator.constructor(m_subgraph, m_parameters->getWordSize(), m_parameters);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	LargeCount cleared=0;
 	#endif
 
@@ -2117,7 +2117,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 		Kmer key=*(iterator.getKey());
 		m_subgraph->clearDirections(&key);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		cleared++;
 
 		Vertex*node=m_subgraph->find(&key);
@@ -2126,7 +2126,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 		#endif
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(cleared != m_subgraph->size()){
 		cout<<"Hilarious error: cleared, expected: "<<m_subgraph->size()<<", actual: "<<cleared<<endl;
 	}
@@ -2182,7 +2182,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 
 	for(int i=0;i<(int)fusions.size();i++){
 		PathHandle id=getPathUniqueId(m_rank,i);
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_rank<m_size);
 		assert(m_rank>=0);
 		assert(m_size>=1);
@@ -2193,7 +2193,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 
 	m_fusionData->m_FUSION_identifier_map.clear();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_fusionData->m_FUSION_identifier_map.size()==0);
 	#endif
 
@@ -2205,7 +2205,7 @@ void MessageProcessor::call_RAY_MPI_TAG_CLEAR_DIRECTIONS(Message*message){
 	(m_ed->m_EXTENSION_contigs).clear();
 	(m_ed->m_EXTENSION_contigs)=fusions;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ed->m_EXTENSION_contigs.size()==m_ed->m_EXTENSION_identifiers.size());
 	assert(m_fusionData->m_FUSION_identifier_map.size()==m_ed->m_EXTENSION_contigs.size());
 	#endif
@@ -2264,7 +2264,7 @@ void MessageProcessor::call_RAY_MPI_TAG_EXTENSION_START(Message*message){
 
 	PathHandle id=incoming[0];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	Rank rank=getRankFromPathUniqueId(id);
 	assert(rank<m_size);
 	#endif
@@ -2291,7 +2291,7 @@ void MessageProcessor::call_RAY_MPI_TAG_GET_PATH_VERTEX(Message*message){
 		PathHandle id=incoming[i];
 		int position=incoming[i+1];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_fusionData->m_FUSION_identifier_map.count(id)>0);
 		if(position>=(int)(m_ed->m_EXTENSION_contigs)[m_fusionData->m_FUSION_identifier_map[id]].size()){
 			cout<<"Pos="<<position<<" Length="<<(m_ed->m_EXTENSION_contigs)[m_fusionData->m_FUSION_identifier_map[id]].size()<<endl;
@@ -2381,7 +2381,7 @@ void MessageProcessor::call_RAY_MPI_TAG_UPDATE_LIBRARY_INFORMATION(Message*messa
 
 		int library=incoming[i+0];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_parameters->isAutomatic(library));
 		#endif
 
@@ -2415,7 +2415,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_READ_SEQUENCE(Message*message){
 	MessageUnit*incoming=(MessageUnit*)buffer;
 	int index=incoming[0];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(index<(int)m_myReads->size());
 	#endif
 
@@ -2426,7 +2426,7 @@ void MessageProcessor::call_RAY_MPI_TAG_REQUEST_READ_SEQUENCE(Message*message){
 		t=&dummy;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(t!=NULL);
 	#endif
 
diff --git a/code/Mock/Mock.cpp b/code/Mock/Mock.cpp
index 2bad1af..5086829 100644
--- a/code/Mock/Mock.cpp
+++ b/code/Mock/Mock.cpp
@@ -41,7 +41,9 @@ void Mock::resolveSymbols(ComputeCore*core){
 		Mother * mother = new Mother();
 
 		mother->setParameters(parameters);
-		m_core->spawnActor(mother);
+		m_core->spawn(mother);
+
+		m_core->setActorModelOnly();
 	}
 }
 
diff --git a/code/Mock/Parameters.cpp b/code/Mock/Parameters.cpp
index 97970dd..58ac66e 100644
--- a/code/Mock/Parameters.cpp
+++ b/code/Mock/Parameters.cpp
@@ -548,7 +548,7 @@ void Parameters::parseCommands(){
 
 			int meanFragmentLength=0;
 			int standardDeviation=0;
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(items==1 or items==3);
 			#endif
 
@@ -581,7 +581,7 @@ void Parameters::parseCommands(){
 					cout<<" Standard deviation: automatic detection"<<endl;
 				}
 			}else{
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(false);
 				#endif
 			}
@@ -654,7 +654,7 @@ void Parameters::parseCommands(){
 
 			int meanFragmentLength=0;
 			int standardDeviation=0;
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(items==4 or items==2);
 			#endif
 
@@ -953,7 +953,7 @@ void Parameters::parseCommands(){
  * There is not really any limit on the number of files.
  * The limit is on the number of paired libraries (2^sizeof(uint16_t)).
  */
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	LibraryHandle maximumLibraryIndex=0;
 	maximumLibraryIndex--;
 
@@ -981,7 +981,7 @@ void Parameters::writeCommandFile(){
 
 	int numberOfRays=getSize();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(numberOfRays%m_numberOfMiniRanksPerRank==0);
 	#endif
 
@@ -1025,7 +1025,7 @@ void Parameters::writeSmartCommand() {
 
 	int numberOfRays=getSize();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(numberOfRays%m_numberOfMiniRanksPerRank==0);
 	#endif
 
@@ -1135,7 +1135,7 @@ void Parameters::setDefaultRoutingOptions() {
 
 		radix--;
 
-		if(radix == 1)
+		if(radix <= 1)
 			break;
 
 		if(foundSolution)
@@ -1407,7 +1407,7 @@ int Parameters::getNumberOfLibraries(){
 }
 
 LargeCount Parameters::getNumberOfSequences(int file){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(file>=(int)m_numberOfSequencesInFile.size())
 		cout<<"Error File= "<<file<<" Files: "<<m_numberOfSequencesInFile.size()<<endl;
 
@@ -1530,6 +1530,10 @@ void Parameters::showUsage(){
 	cout<<"    - taxonomy profiling of samples (with Ray Communities)"<<endl;
 	cout<<"    - gene ontology profiling of samples (with Ray Ontologies)"<<endl;
 	cout<<endl;
+
+	cout<<"    - compare DNA samples using words (Ray -run-surveyor ...; see Ray Surveyor options)"<<endl;
+
+	cout<<endl;
 	showOption("-help","Displays this help page.");
 	cout<<endl;
 	showOption("-version","Displays Ray version and compilation options.");
@@ -1598,6 +1602,22 @@ void Parameters::showUsage(){
 	showOptionDescription("Other name: -output");
 	cout<<endl;
 
+	cout << "  Ray Surveyor options" << endl;
+	cout<<endl;
+	showOption("-run-surveyor", "Runs Ray Surveyor to compare samples.");
+	showOptionDescription("See Documentation/Ray-Surveyor.md");
+	showOptionDescription("This workflow generates:");
+	showOptionDescription("RayOutput/Surveyor/SimilarityMatrix.tsv is a similarity Gramian matrix based on shared DNA words");
+	showOptionDescription("RayOutput/Surveyor/DistanceMatrix.tsv is a distance matrix (kernel-based).");
+
+	showOption("-read-sample-graph SampleName SampleGraphFile", "Reads a sample graph (generated with -write-kmers)");
+
+	cout<<endl;
+
+
+
+
+
 	cout<<"  Assembly options (defaults work well)"<<endl;
 	cout<<endl;
 
@@ -1622,6 +1642,11 @@ void Parameters::showUsage(){
 
 	showOption("-disable-scaffolder","Disables the scaffolder.");
 	cout<<endl;
+
+	showOption("-minimum-seed-length minimumSeedLength",
+		"Changes the minimum seed length, default is 100 nucleotides");
+	cout<<endl;
+
 	showOption("-minimum-contig-length minimumContigLength",
 		"Changes the minimum contig length, default is 100 nucleotides");
 	cout<<endl;
@@ -1710,10 +1735,15 @@ void Parameters::showUsage(){
 	showOptionDescription("An AMOS file contains read positions on contigs.");
 	showOptionDescription("Can be opened with software with graphical user interface.");
 	cout<<endl;
+
 	showOption("-write-kmers","Writes k-mer graph to RayOutput/kmers.txt");
 	showOptionDescription("The resulting file is not utilised by Ray.");
 	showOptionDescription("The resulting file is very large.");
 	cout<<endl;
+
+	showOption("-graph-only","Exits after building graph.");
+	cout<<endl;
+
 	showOption("-write-read-markers","Writes read markers to disk.");
 	cout<<endl;
 	showOption("-write-seeds","Writes seed DNA sequences to RayOutput/Rank<rank>.RaySeeds.fasta");
@@ -2028,7 +2058,7 @@ Rank Parameters::getRankFromGlobalId(ReadHandle & a){
 		rank=m_size-1;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 
 	if(rank<0){
 		cout<<"Error: rank is < 0, rank: "<<rank<<" ReadHandle: "<<a<<" elementsPerRank: "<<elementsPerRank;
@@ -2281,7 +2311,7 @@ bool Parameters::hasConfigurationOption(const char*string,int count){
 
 double Parameters::getConfigurationDouble(const char*string,int offset){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasConfigurationOption(string,offset+1));
 	#endif
 
@@ -2303,7 +2333,7 @@ double Parameters::getConfigurationDouble(const char*string,int offset){
 
 const char*Parameters::getConfigurationString(const char*string,int offset){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasConfigurationOption(string,offset+1));
 	#endif
 
@@ -2319,7 +2349,7 @@ const char*Parameters::getConfigurationString(const char*string,int offset){
 
 
 uint64_t Parameters::getConfigurationInteger(const char*string,int offset){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasConfigurationOption(string,offset+1));
 	#endif
 
@@ -2368,7 +2398,7 @@ void Parameters::__shuffleOperationCodes(){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(newCommands.size()==m_commands.size());
 	#endif
 
diff --git a/code/Mock/common_functions.cpp b/code/Mock/common_functions.cpp
index 805c9df..a74bc5b 100644
--- a/code/Mock/common_functions.cpp
+++ b/code/Mock/common_functions.cpp
@@ -86,7 +86,7 @@ string convertToString(GraphPath*b,int m_wordSize,bool color){
 }
 
 Kmer kmerAtPosition(const char*m_sequence,int pos,int w,char strand,bool color){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(w<=CONFIG_MAXKMERLENGTH);
 	#endif
 	int length=strlen(m_sequence);
@@ -194,7 +194,7 @@ Kmer wordId(const char*a){
 		int bitPosition=2*j;
 		int chunk=bitPosition/64;
 		int bitPositionInChunk=bitPosition%64;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(!(chunk<i.getNumberOfU64())){
 			cout<<"Chunk="<<chunk<<" positionInKmer="<<j<<" KmerLength="<<strlen(a)<<" bitPosition=" <<bitPosition<<" Chunks="<<i.getNumberOfU64()<<endl;
 		}
diff --git a/code/Mock/common_functions.h b/code/Mock/common_functions.h
index bd18f52..ace9e11 100644
--- a/code/Mock/common_functions.h
+++ b/code/Mock/common_functions.h
@@ -42,7 +42,7 @@ see <http://www.gnu.org/licenses/>
 #include <iostream>
 #include <vector>
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
diff --git a/code/NetworkTest/NetworkTest.cpp b/code/NetworkTest/NetworkTest.cpp
index 4d73103..66c55f7 100644
--- a/code/NetworkTest/NetworkTest.cpp
+++ b/code/NetworkTest/NetworkTest.cpp
@@ -135,7 +135,7 @@ void NetworkTest::call_RAY_SLAVE_MODE_TEST_NETWORK(){
 			m_switchMan->closeSlaveModeLocally(m_outbox,m_parameters->getRank());
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_numberOfWords*sizeof(MessageUnit) <= MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 	#endif
 
@@ -255,7 +255,7 @@ void NetworkTest::writeData(){
 		f<<"# next line contains column names"<<endl;
 		f<<"# TestMessage SourceRank DestinationRank QueryTimeInMicroseconds ReplyTimeInMicroseconds Latency MessagesSentToDestination"<<endl;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_sentMicroseconds.size() == m_destinations.size());
 		assert(m_sentMicroseconds.size() == m_receivedMicroseconds.size());
 		assert((int) m_sentMicroseconds.size() == m_numberOfTestMessages);
diff --git a/code/Partitioner/Partitioner.cpp b/code/Partitioner/Partitioner.cpp
index a4895a4..b284e6f 100644
--- a/code/Partitioner/Partitioner.cpp
+++ b/code/Partitioner/Partitioner.cpp
@@ -255,14 +255,14 @@ void Partitioner::call_RAY_SLAVE_MODE_COUNT_FILE_ENTRIES(){
 				f.read((char*)&file,sizeof(int));
 				f.read((char*)&sequences,sizeof(LargeCount));
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(file>=0);
 				assert(m_slaveCounts.count(file)==0);
 				#endif
 
 				m_slaveCounts[file]=sequences;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_slaveCounts.count(file)>0);
 				#endif
 				cout<<"Rank "<<m_parameters->getRank()<<": from checkpoint Partition, file "<<file<<" has "<<sequences<<" sequences."<<endl;
diff --git a/code/Scaffolder/Scaffolder.cpp b/code/Scaffolder/Scaffolder.cpp
index 3093471..8c05e5f 100644
--- a/code/Scaffolder/Scaffolder.cpp
+++ b/code/Scaffolder/Scaffolder.cpp
@@ -157,7 +157,7 @@ void Scaffolder::solve(){
 						int average=sum/n;
 						operationBuffer<<"contig-"<<leftContig<<"\t"<<leftStrand<<"\tcontig-"<<rightContig<<"\t"<<rightStrand<<"\t"<<average;
 
-						#ifdef ASSERT
+						#ifdef CONFIG_ASSERT
 						assert(averageValues.size() == countValues.size());
 						assert(standardDeviationValues.size() == countValues.size());
 						#endif
@@ -343,7 +343,7 @@ void Scaffolder::computeStatistics(vector<int>*lengths,int minimumLength,ostream
 			break;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i<(int)accepted.size());
 	#endif
 	int n50=accepted[i];
@@ -384,7 +384,7 @@ void Scaffolder::constructor(StaticVector*outbox,StaticVector*inbox,RingAllocato
 	m_initialised=false;
 	m_workerId=0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_parameters!=NULL);
 	#endif
 
@@ -485,7 +485,7 @@ void Scaffolder::getCoverageOfBlockOfLife(){
 			vector<MessageUnit> elements;
 			m_virtualCommunicator->getMessageResponseElements(m_workerId,&elements);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(elements.size() > 0);
 			#endif
 
@@ -596,7 +596,7 @@ void Scaffolder::sendSummary(){
 
 void Scaffolder::performSummary(){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_contigId < (int)m_contigs->size());
 	assert((int)m_vertexCoverageValues.size() == (*m_contigs)[m_contigId].size());
 	#endif
@@ -669,7 +669,7 @@ void Scaffolder::performSummary(){
 			fp.open(fileName.str().c_str(),ios_base::out|ios_base::app);
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_contigId < (int)m_contigNames->size());
 		#endif
 
@@ -750,7 +750,7 @@ void Scaffolder::performSummary(){
 }
 
 void Scaffolder::processContigPosition(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_contigId<(int)(*m_contigs).size());
 	assert(m_positionOnContig<(int)(*m_contigs)[m_contigId].size());
 	#endif
@@ -758,7 +758,7 @@ void Scaffolder::processContigPosition(){
 	Kmer vertex;
 	(*m_contigs)[m_contigId].at(m_positionOnContig,&vertex);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_parameters!=NULL);
 	#endif
 	if(!m_forwardDone){
@@ -842,7 +842,7 @@ void Scaffolder::processVertex(Kmer*vertex){
 		vector<MessageUnit> elements;
 		m_virtualCommunicator->getMessageResponseElements(m_workerId,&elements);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(elements.size() > 0);
 		#endif
 
@@ -1510,7 +1510,7 @@ void Scaffolder::getContigSequenceFromPackedObjects(PathHandle id){
 				int elementIndex=(iterator*BITS_PER_NUCLEOTIDE ) / (sizeof(MessageUnit)*BITS_PER_BYTE);
 				int offset=(iterator*BITS_PER_NUCLEOTIDE) % (sizeof(MessageUnit)*BITS_PER_BYTE);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(sizeof(MessageUnit)==sizeof(uint64_t));
 				#endif
 
@@ -1534,7 +1534,7 @@ void Scaffolder::getContigSequenceFromPackedObjects(PathHandle id){
 		m_contigSequence=m_contigPathBuffer.str();
 		m_hasContigSequence=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if((int)m_contigSequence.length()!=m_theLengthInNucleotides){
 			cout<<"expected: "<<m_theLengthInNucleotides<<" actual: "<<m_contigSequence.length()<<endl;
 		}
@@ -1585,7 +1585,7 @@ void Scaffolder::getContigSequenceFromKmers(PathHandle id){
 		}
 	}else{
 		/* we should receive a correct number of vertices */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert((int)m_contigPath.size()==m_theLength);
 		#endif
 
@@ -1635,7 +1635,7 @@ void Scaffolder::call_RAY_MASTER_MODE_WRITE_SCAFFOLDS(){
 
 				int length=m_contigSequence.length();
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				int theLength=m_contigLengths[contigNumber]+m_parameters->getWordSize()-1;
 				assert(length==theLength);
 				#endif
@@ -1736,7 +1736,7 @@ void Scaffolder::call_RAY_MPI_TAG_GET_CONTIG_PACKED_CHUNK(Message*message){
 	PathHandle contigId=incoming[thePosition++];
 	int nucleotidePosition=incoming[thePosition++];
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_contigNameIndex->count(contigId)>0);
 #endif
 
@@ -1759,7 +1759,7 @@ void Scaffolder::call_RAY_MPI_TAG_GET_CONTIG_PACKED_CHUNK(Message*message){
 // clear bits
 	memset(messageContent,0,MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(index<(int)m_contigs->size());
 #endif
 
@@ -1779,7 +1779,7 @@ void Scaffolder::call_RAY_MPI_TAG_GET_CONTIG_PACKED_CHUNK(Message*message){
 
 		int localPosition=nucleotidePosition-kmerPosition;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(localPosition>=0);
 		assert(localPosition<kmerLength);
 #endif
@@ -1830,7 +1830,7 @@ void Scaffolder::call_RAY_MPI_TAG_GET_CONTIG_CHUNK(Message*message){
 	PathHandle contigId=incoming[thePosition++];
 	int position=incoming[thePosition++];
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_contigNameIndex->count(contigId)>0);
 #endif
 
@@ -1846,7 +1846,7 @@ void Scaffolder::call_RAY_MPI_TAG_GET_CONTIG_CHUNK(Message*message){
 	 && (outputPosition+KMER_U64_ARRAY_SIZE)<(int)(MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit))){
 		Kmer theKmerObject;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(index<(int)m_contigs->size());
 #endif
 		(*m_contigs)[index].at(position++,&theKmerObject);
@@ -1957,7 +1957,7 @@ void Scaffolder::resolveSymbols(ComputeCore*core){
 
 	m_contigNameIndex=(map<PathHandle,int>*)core->getObjectFromSymbol(m_plugin, "/RayAssembler/ObjectStore/ContigNameIndex.ray");
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_contigNameIndex!=NULL);
 #endif
 }
diff --git a/code/Scaffolder/ScaffoldingAlgorithm.cpp b/code/Scaffolder/ScaffoldingAlgorithm.cpp
index 82db776..9f72500 100644
--- a/code/Scaffolder/ScaffoldingAlgorithm.cpp
+++ b/code/Scaffolder/ScaffoldingAlgorithm.cpp
@@ -382,7 +382,7 @@ bool ScaffoldingAlgorithm::hasConflictWithEdgeAroundContig(ScaffoldingEdge*edgeT
 
 		int edge2ContigSideReverse=reverseEdge.getSide(contigToCheck);
 	
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		char edge2ContigStrandReverse=reverseEdge.getStrand(contigToCheck);
 		assert(edge2ContigStrandReverse == edge1ContigStrand);
 		#endif
@@ -419,7 +419,7 @@ void ScaffoldingAlgorithm::extractScaffolds(char state,map<PathHandle,int>*color
 
 	if((*parents).count(vertex)>0&&(*parents)[vertex].count(state)>0){
 		for(int i=0;i<(int)(*parents)[vertex][state].size();i++){
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(0<(*parents)[vertex][state][i].size());
 			#endif
 			PathHandle parent=(*parents)[vertex][state][i][0];
@@ -441,20 +441,20 @@ void ScaffoldingAlgorithm::extractScaffolds(char state,map<PathHandle,int>*color
 		if((*children).count(vertex)>0&&(*children)[vertex].count(state)>0){
 			bool found=false;
 			for(int i=0;i<(int)(*children)[vertex][state].size();i++){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(2<(*children)[vertex][state][i].size());
 				#endif
 
 				PathHandle childVertex=(*children)[vertex][state][i][2];
 				int childColor=(*colors)[childVertex];
 				if(childColor==currentColor){
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(3<(*children)[vertex][state][i].size());
 					#endif
 
 					char childState=(*children)[vertex][state][i][3];
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(4<(*children)[vertex][state][i].size());
 					#endif
 
diff --git a/code/Scaffolder/ScaffoldingEdge.cpp b/code/Scaffolder/ScaffoldingEdge.cpp
index 7020f51..84ea51d 100644
--- a/code/Scaffolder/ScaffoldingEdge.cpp
+++ b/code/Scaffolder/ScaffoldingEdge.cpp
@@ -166,7 +166,7 @@ void ScaffoldingEdge::print(){
 }
 
 Strand ScaffoldingEdge::getStrand(PathHandle name){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(name==getLeftContig() || name==getRightContig());
 	#endif
 
@@ -179,7 +179,7 @@ Strand ScaffoldingEdge::getStrand(PathHandle name){
 }
 
 int ScaffoldingEdge::getSide(PathHandle name){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(name==getLeftContig() || name==getRightContig());
 	#endif
 
diff --git a/code/Searcher/ColorSet.cpp b/code/Searcher/ColorSet.cpp
index 6d73741..51672d1 100644
--- a/code/Searcher/ColorSet.cpp
+++ b/code/Searcher/ColorSet.cpp
@@ -30,13 +30,13 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT_LOW_LEVEL
+#ifdef CONFIG_ASSERT_LOW_LEVEL
 #ifndef ASSERT
 #define ASSERT
 #endif /* ASSERT */
 #endif /* ASSERT_LOW_LEVEL */
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif /* ASSERT */
 
@@ -75,7 +75,7 @@ ColorSet::ColorSet(){
 /** O(1) **/
 void ColorSet::incrementReferences(VirtualKmerColorHandle handle){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(handle < getTotalNumberOfVirtualColors());
 	#endif
 
@@ -93,7 +93,7 @@ void ColorSet::incrementReferences(VirtualKmerColorHandle handle){
 
 	virtualColor->incrementReferences();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.count(handle)==0);
 	assert(getVirtualColor(handle)->getNumberOfReferences()>=1);
 	#endif
@@ -102,7 +102,7 @@ void ColorSet::incrementReferences(VirtualKmerColorHandle handle){
 }
 
 void ColorSet::decrementReferences(VirtualKmerColorHandle handle){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(handle < getTotalNumberOfVirtualColors());
 	#endif
 
@@ -112,7 +112,7 @@ void ColorSet::decrementReferences(VirtualKmerColorHandle handle){
 	if(handle == NULL_VIRTUAL_COLOR)
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.count(handle)==0);
 	assert(virtualColor->getNumberOfReferences()>0);
 	#endif
@@ -129,7 +129,7 @@ void ColorSet::decrementReferences(VirtualKmerColorHandle handle){
 }
 
 void ColorSet::purgeVirtualColor(VirtualKmerColorHandle handle){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getVirtualColor(handle)->getNumberOfReferences()==0);
 	#endif
 
@@ -146,7 +146,7 @@ void ColorSet::purgeVirtualColor(VirtualKmerColorHandle handle){
 	// actually, they are simply not removed.
 	// instead, they are re-used.
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.count(handle)==0);
 	#endif
 
@@ -156,7 +156,7 @@ void ColorSet::purgeVirtualColor(VirtualKmerColorHandle handle){
 	// because it may be useful sometime
 	// correction: we do remove it right now.
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.count(handle)>0);
 	assert(virtualColorToPurge->getNumberOfPhysicalColors()==0);
 	assert(virtualColorToPurge->getNumberOfReferences()==0);
@@ -167,7 +167,7 @@ void ColorSet::purgeVirtualColor(VirtualKmerColorHandle handle){
 
 /** O(1) **/
 VirtualKmerColor*ColorSet::getVirtualColor(VirtualKmerColorHandle handle){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(handle>= getTotalNumberOfVirtualColors())
 		cout<<"Error, handle= "<<handle<<" but size= "<<getTotalNumberOfVirtualColors()<<endl;
 
@@ -308,7 +308,7 @@ VirtualKmerColorHandle ColorSet::allocateVirtualColorHandle(){
 		// instead, it will be removed from the avaialble list
 		// when its references are > 0
 	
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(getVirtualColor(handle)->getNumberOfReferences()==0);
 		assert(getVirtualColor(handle)->getPhysicalColors()->size()==0);
 		#endif
@@ -320,7 +320,7 @@ VirtualKmerColorHandle ColorSet::allocateVirtualColorHandle(){
 		return handle;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.size()==0);
 	#endif
 
@@ -333,7 +333,7 @@ VirtualKmerColorHandle ColorSet::allocateVirtualColorHandle(){
 
 	m_operations[OPERATION_NEW_FROM_SCRATCH]++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.size()==1);
 	#endif
 
@@ -373,7 +373,7 @@ uint64_t ColorSet::applyHashOperation(uint64_t hashValue,PhysicalKmerColor color
 }
 
 LargeCount ColorSet::getNumberOfReferences(VirtualKmerColorHandle handle){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(handle< getTotalNumberOfVirtualColors());
 	#endif
 	
@@ -382,7 +382,7 @@ LargeCount ColorSet::getNumberOfReferences(VirtualKmerColorHandle handle){
 
 int ColorSet::getNumberOfPhysicalColors(VirtualKmerColorHandle handle){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(handle< getTotalNumberOfVirtualColors());
 	#endif
 
@@ -391,10 +391,18 @@ int ColorSet::getNumberOfPhysicalColors(VirtualKmerColorHandle handle){
 
 VirtualKmerColorHandle ColorSet::getVirtualColorFrom(VirtualKmerColorHandle handle,PhysicalKmerColor color){
 
-	#ifdef ASSERT
-	assert(handle<getTotalNumberOfVirtualColors());
+	#ifdef CONFIG_ASSERT
+	assert(handle < getTotalNumberOfVirtualColors());
 	assert(!getVirtualColor(handle)->hasPhysicalColor(color));
+
+	// the handle may be available if the number of references
+	// was decremented before the call to getVirtualColorFrom
+	//
+	// on second thought, it is better to decrement after
+	// because all this code is designed like this
+	//
 	assert(m_availableHandles.count(handle)==0);
+
 	#endif
 
 	m_operations[OPERATION_getVirtualColorFrom]++;
@@ -415,14 +423,19 @@ VirtualKmerColorHandle ColorSet::getVirtualColorFrom(VirtualKmerColorHandle hand
 	uint64_t expectedHash=applyHashOperation(oldHash,color);
 
 	// case 3. no virtual color has the expected hash value
-	if(m_index.count(expectedHash)==0){
+	if(m_index.count(expectedHash) == 0){
 
 		// case X.: the virtual color has only one reference
+		// this reference is the one provided in input
+		// to the current call.
 		// in that case, we can just add the color to it and
 		// update its hash...
 		// but before doing that, we need to check that no one has the expectedHash
 	
-		if(oldVirtualColor->getNumberOfReferences()==1){
+		// I am not sure this is a valid approach.
+		// anyway, this will never happen because
+		// handles are purged when they reach 0 references
+		if(oldVirtualColor->getNumberOfReferences() == 1){
 			// we can update it, no problem
 			// because nobody is using it
 			// it is the copy-on-write design pattern I guess
@@ -449,14 +462,14 @@ VirtualKmerColorHandle ColorSet::getVirtualColorFrom(VirtualKmerColorHandle hand
 
 		m_operations[OPERATION_NO_VIRTUAL_COLOR_HAS_HASH_CREATION]++;
 
-		#ifdef ASSERT_LOW_LEVEL
+		#ifdef CONFIG_ASSERT_LOW_LEVEL
 		assertNoVirtualColorDuplicates(handle,color,433);
 		#endif /* ASSERT_LOW_LEVEL */
 	
 		return createVirtualColorFrom(handle,color);
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_index.count(expectedHash)>0);
 	assert(m_index[expectedHash].size()>=1);
 	#endif /* ASSERT */
@@ -484,7 +497,7 @@ VirtualKmerColorHandle ColorSet::getVirtualColorFrom(VirtualKmerColorHandle hand
 
 		if(toCheck->virtualColorHasAllPhysicalColorsOf(oldVirtualColor,color)){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(virtualColorHasPhysicalColor(virtualColorToInvestigate,color));
 			#endif /* ASSERT */
 	
@@ -499,7 +512,7 @@ VirtualKmerColorHandle ColorSet::getVirtualColorFrom(VirtualKmerColorHandle hand
 	
 	m_operations[OPERATION_NO_VIRTUAL_COLOR_HAS_COLORS_CREATION]++;
 
-	#ifdef ASSERT_LOW_LEVEL
+	#ifdef CONFIG_ASSERT_LOW_LEVEL
 	assertNoVirtualColorDuplicates(handle,color,479);
 	#endif
 
@@ -513,7 +526,7 @@ VirtualKmerColorHandle ColorSet::createVirtualColorFrom(VirtualKmerColorHandle h
 	// consume the handle
 	m_availableHandles.erase(newHandle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!getVirtualColor(handle)->hasPhysicalColor(color));
 	assert(m_availableHandles.count(newHandle)==0);
 	assert(getNumberOfReferences(newHandle)==0);
@@ -537,7 +550,7 @@ VirtualKmerColorHandle ColorSet::createVirtualColorFrom(VirtualKmerColorHandle h
 
 	m_operations[OPERATION_createVirtualColorFrom]++;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getVirtualColor(newHandle)->getNumberOfPhysicalColors()==getVirtualColor(handle)->getNumberOfPhysicalColors()+1);
 	assert(getVirtualColor(newHandle)->getNumberOfReferences()==0);
 	assert(getVirtualColor(newHandle)->virtualColorHasAllPhysicalColorsOf(oldVirtualColor,color));
@@ -608,7 +621,7 @@ void ColorSet::assertNoVirtualColorDuplicates(VirtualKmerColorHandle handle,Phys
 				printPhysicalColors(getVirtualColor(handle)->getPhysicalColors());
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(!getVirtualColor(i)->hasPhysicalColors(&desiredColors));
 			#endif /* ASSERT */
 		}
@@ -648,13 +661,13 @@ VirtualKmerColorHandle ColorSet::createVirtualColorFromPhysicalColors(set<Physic
 	if(colors->size()==0)
 		return NULL_VIRTUAL_COLOR;
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(colors->size()!=0);
 	#endif /* ASSERT */
 
 	VirtualKmerColorHandle newHandle=allocateVirtualColorHandle();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_availableHandles.count(newHandle)>0);
 	#endif /* ASSERT */
 
@@ -668,7 +681,7 @@ VirtualKmerColorHandle ColorSet::createVirtualColorFromPhysicalColors(set<Physic
 	newVirtualColor->setHash(expectedHash);
 	addVirtualColorToIndex(newHandle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(lookupVirtualColor(colors)!=NULL_VIRTUAL_COLOR);
 	#endif /* ASSERT */
 
diff --git a/code/Searcher/ColorSet.h b/code/Searcher/ColorSet.h
index 8301e18..d4d0569 100644
--- a/code/Searcher/ColorSet.h
+++ b/code/Searcher/ColorSet.h
@@ -39,8 +39,11 @@ using namespace std;
 #define COLOR_NAMESPACE_MULTIPLIER 10000000000000000ULL
 
 // colors in the phylogeny namespace: 1024 * 10000000000000000 + identifier 
-#define COLOR_NAMESPACE_PHYLOGENY 	1024
+// available slots: 0 to 1844
+// each -search uses one slot, starting at 0
 #define COLOR_NAMESPACE_EMBL_CDS 	789
+#define COLOR_NAMESPACE_PHYLOGENY 	1024
+#define COLOR_NAMESPACE_SAMPLE          1200
 
 typedef uint32_t VirtualKmerColorHandle;
 
diff --git a/code/Searcher/DistributionWriter.cpp b/code/Searcher/DistributionWriter.cpp
index b1c7aba..0f3150c 100644
--- a/code/Searcher/DistributionWriter.cpp
+++ b/code/Searcher/DistributionWriter.cpp
@@ -27,7 +27,7 @@
 #include <iostream>
 using namespace std;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
diff --git a/code/Searcher/QualityCaller.cpp b/code/Searcher/QualityCaller.cpp
index ea11a4c..afb4c51 100644
--- a/code/Searcher/QualityCaller.cpp
+++ b/code/Searcher/QualityCaller.cpp
@@ -34,7 +34,7 @@ double QualityCaller::computeCorrelation(vector<int>*x,vector<int>*y){
 	if(x->size()==0)
 		return 0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(x->size()==y->size());
 	#endif
 
diff --git a/code/Searcher/SearchDirectory.cpp b/code/Searcher/SearchDirectory.cpp
index 2f0bb62..4eae4a8 100644
--- a/code/Searcher/SearchDirectory.cpp
+++ b/code/Searcher/SearchDirectory.cpp
@@ -94,7 +94,7 @@ void SearchDirectory::readDirectory(){
 }
 
 int SearchDirectory::getCount(int i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(i>=(int)m_counts.size()){
 		cout<<"Error, file= "<<i<<" but size= "<<m_counts.size()<<endl;
 		cout<<"Directory= "<<getDirectoryName()<<endl;
@@ -108,7 +108,7 @@ int SearchDirectory::getCount(int i){
 }
 
 void SearchDirectory::countEntriesInFile(int fileNumber){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(fileNumber<(int)m_files.size());
 	#endif
 
@@ -153,7 +153,7 @@ int SearchDirectory::getSize(){
 
 void SearchDirectory::setCount(int file,int count){
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int current=m_counts[file];
 	if(current!=0){
 		assert(current==count);
@@ -165,7 +165,7 @@ void SearchDirectory::setCount(int file,int count){
 
 void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(file<(int)m_files.size());
 	assert(sequence<m_counts[file]);
 	#endif
@@ -177,7 +177,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 		cout<<"Closing current file"<<endl;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		//assert(m_currentFileStream.is_open());
 		#endif
 
@@ -185,7 +185,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 		m_currentFileStream=NULL;
 		m_hasFile=false;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		//assert(!m_currentFileStream.is_open());
 		assert(m_currentFileStream==NULL);
 		#endif
@@ -195,7 +195,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 	// open the file
 	if(!m_hasFile){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_currentFileStream==NULL);
 		#endif
 
@@ -215,14 +215,14 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 
 		m_hasFile=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		//assert(m_currentFileStream.is_open());
 		assert(m_currentFileStream!=NULL);
 		assert(m_hasFile);
 		#endif
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_hasFile);
 	assert(m_currentFile==file);
 	assert(m_currentFileStream!=NULL);
@@ -253,7 +253,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(m_currentSequence!=sequence){
 		cout<<"Expected: "<<sequence<<" Actual: "<<m_currentSequence<<endl;
 	}
@@ -274,7 +274,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 
 	m_currentSequenceNumberOfAvailableKmers=0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(strlen(m_currentSequenceHeader)>0);
 	assert(m_currentSequenceHeader[0]=='>');
 	assert(strlen(m_currentSequenceBuffer)==0);
@@ -286,7 +286,7 @@ void SearchDirectory::createSequenceReader(int file,int sequence,int kmerLength)
 void SearchDirectory::readLineFromFile(char*line,int length){
 	// use the buffer
 	if(m_hasBufferedLine){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_hasBufferedLine);
 		#endif
 
@@ -298,20 +298,20 @@ void SearchDirectory::readLineFromFile(char*line,int length){
 		cout<<"Using buffered line!"<<endl;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(!m_hasBufferedLine);
 		#endif
 
 		return;
 	}
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(strlen(m_bufferedLine)==0);
 	assert(!m_hasBufferedLine);
 	assert(m_currentFileStream!=NULL);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(line!=NULL);
 	assert(length>0);
 	assert(m_currentFileStream!=NULL);
@@ -333,7 +333,7 @@ int SearchDirectory::getCurrentSequenceLengthInKmers(){
 
 bool SearchDirectory::hasNextKmer(int kmerLength){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(kmerLength>0);
 	#endif
 
@@ -371,7 +371,7 @@ bool SearchDirectory::hasNextKmer(int kmerLength){
 			cout<<"Closing file in hasNextKmer"<<endl;
 			#endif
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			//assert(m_currentFileStream.is_open());
 			assert(m_currentFileStream!=NULL);
 			#endif
@@ -381,11 +381,11 @@ bool SearchDirectory::hasNextKmer(int kmerLength){
 			m_hasFile=false;
 			m_currentFileStream=NULL;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			//assert(!m_currentFileStream.is_open());
 			#endif
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_hasFile==false);
 			assert(m_currentFileStream==NULL);
 			#endif
@@ -413,7 +413,7 @@ void SearchDirectory::iterateToNextKmer(){
 
 void SearchDirectory::getNextKmer(int kmerLength,Kmer*kmer){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(kmerLength>0);
 	#endif
 
@@ -427,7 +427,7 @@ void SearchDirectory::getNextKmer(int kmerLength,Kmer*kmer){
 	memcpy(sequenceBuffer,m_currentSequenceBuffer+m_currentSequencePosition,kmerLength);
 	sequenceBuffer[kmerLength]='\0';
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((int)strlen(sequenceBuffer)==kmerLength);
 	#endif
 
@@ -484,7 +484,7 @@ string SearchDirectory::getCurrentSequenceName(){
 			position+=2;
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(position>=currentSequenceHeader.length()){
 			cout<<"Header= "<<currentSequenceHeader<<endl;
 		}
@@ -501,7 +501,7 @@ string SearchDirectory::getCurrentSequenceName(){
 	// remove the '>' and keep only maximumLength characters.
 	//cout<<"code 108"<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(currentSequenceHeader.length()==0){
 		cout<<"currentSequenceHeader is empty, fatal"<<endl;
 	}
@@ -518,7 +518,7 @@ void SearchDirectory::loadSomeSequence(){
 	if(m_noMoreSequence)
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_currentFileStream!=NULL);
 	assert(!m_noMoreSequence);
 	#endif
@@ -540,7 +540,7 @@ void SearchDirectory::loadSomeSequence(){
 
 	while(m_currentSequencePosition<theLength){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(theLength>0);
 		#endif
 
@@ -569,7 +569,7 @@ void SearchDirectory::loadSomeSequence(){
 		// rollback to where we were before
 		if(lineIsSequenceHeader(line)){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(strlen(m_bufferedLine)==0);
 			assert(!m_hasBufferedLine);
 			#endif
@@ -605,7 +605,7 @@ void SearchDirectory::loadSomeSequence(){
 	m_currentSequencePosition=0;
 	strcpy(m_currentSequenceBuffer,newContent);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_currentSequencePosition==0);
 	#endif
 
@@ -714,7 +714,7 @@ bool SearchDirectory::hasIdentifier_EMBL_CDS(){
 
 PhysicalKmerColor SearchDirectory::getIdentifier_EMBL_CDS(){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasIdentifier_EMBL_CDS());
 	#endif
 
diff --git a/code/Searcher/Searcher.cpp b/code/Searcher/Searcher.cpp
index 15bbb2a..b663d7c 100644
--- a/code/Searcher/Searcher.cpp
+++ b/code/Searcher/Searcher.cpp
@@ -68,7 +68,7 @@ __CreateMessageTagAdapter(Searcher,RAY_MPI_TAG_VIRTUAL_COLOR_DATA_REPLY);
 using namespace std;
 
 //#define CONFIG_CONTIG_ABUNDANCE_VERBOSE
-#define CONFIG_COUNT_ELEMENTS_VERBOSE
+//#define CONFIG_COUNT_ELEMENTS_VERBOSE
 //#define CONFIG_DEBUG_IOPS
 //#define CONFIG_SEQUENCE_ABUNDANCES_VERBOSE
 //#define CONFIG_CONTIG_IDENTITY_VERBOSE
@@ -206,7 +206,6 @@ void Searcher::call_RAY_MASTER_MODE_COUNT_SEARCH_ELEMENTS(){
 		Message*message=m_inbox->at(0);
 		MessageUnit*buffer=message->getBuffer();
 
-		Rank source=message->getSource();
 
 		int position=0;
 
@@ -215,6 +214,7 @@ void Searcher::call_RAY_MASTER_MODE_COUNT_SEARCH_ELEMENTS(){
 		int count=buffer[position++];
 
 		#ifdef CONFIG_COUNT_ELEMENTS_VERBOSE
+		Rank source=message->getSource();
 		cout<<"Received RAY_MPI_TAG_SEARCH_ELEMENTS from "<<source<<endl;
 		#endif
 
@@ -230,7 +230,7 @@ void Searcher::call_RAY_MASTER_MODE_COUNT_SEARCH_ELEMENTS(){
 	}else if(m_ranksDoneCounting==m_parameters->getSize()){
 		m_ranksDoneCounting=-1;
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_parameters->getRank() == 0);
 		#endif
 
@@ -338,7 +338,7 @@ void Searcher::call_RAY_SLAVE_MODE_COUNT_SEARCH_ELEMENTS(){
 			// must be called.
 			m_searchDirectories=new SearchDirectory[m_searchDirectories_size];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_searchDirectories!=NULL);
 			#endif
 		}
@@ -346,7 +346,7 @@ void Searcher::call_RAY_SLAVE_MODE_COUNT_SEARCH_ELEMENTS(){
 		for(int i=0;i<(int)directories->size();i++){
 			//cout<<"before constructor"<<endl;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_searchDirectories!=NULL);
 			#endif
 
@@ -509,7 +509,7 @@ void Searcher::countKmerObservations(LargeCount*localAssembledKmerObservations,
 
 	while(iterator.hasNext()){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parity==0 || parity==1);
 		#endif
 
@@ -759,13 +759,13 @@ void Searcher::call_RAY_MASTER_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
  */
 void Searcher::call_RAY_MPI_TAG_GRAPH_COUNTS(Message*message){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pumpedCounts==false);
 	#endif
 
 	MessageUnit*buffer=message->getBuffer();
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(message->getCount()==6+1);
 	#endif
 
@@ -851,7 +851,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 		cout<<"Processed all contigs"<<endl;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_bufferedData.isEmpty());
 		#endif
 
@@ -877,7 +877,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 
 		if(m_writeDetailedFiles){ /* now we write coverage frequencies */
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert((int)m_coverageValues.size() == (*m_contigs)[m_contig].size());
 			#endif
 
@@ -899,7 +899,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 				Kmer*kmer=&kmer2;
 				double gcRatio=kmer->getGuanineCytosineProportion(kmerLength,coloredMode);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(coverage>=2);
 				assert(colors>=0);
 				#endif
@@ -981,7 +981,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 
 		m_waitingForAbundanceReply=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_bufferedData.isEmpty());
 		#endif
 
@@ -1049,7 +1049,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 				showContigAbundanceProgress();
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_contig<(int)(*m_contigs).size());
 			assert(m_contigPosition<(int)(*m_contigs)[m_contig].size());
 			#endif
@@ -1099,14 +1099,14 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 			m_pendingMessages+=m_bufferedData.flushAll(RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE_AND_COLORS,m_outboxAllocator,
 				m_outbox,m_parameters->getRank());
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages>0);
 			#endif
 		}
 
 		m_requestedCoverage=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages>0);
 		#endif
 
@@ -1120,7 +1120,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 
 		m_pendingMessages--;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(m_pendingMessages!=0){
 			cout<<"m_pendingMessages is "<<m_pendingMessages<<" but should be "<<m_pendingMessages<<endl;
 		}
@@ -1142,7 +1142,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 			int coverage=buffer[bufferPosition++];
 			int colors=(int)buffer[bufferPosition++];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(coverage>0);
 			#endif
 
@@ -1153,7 +1153,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 			}
 
 			if(m_writeDetailedFiles){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				int length=(*m_contigs)[m_contig].size();
 
 				if(position>=length){
@@ -1176,7 +1176,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 
 		m_requestedCoverage=false;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages==0);
 		assert(m_requestedCoverage==false);
 		#endif
@@ -1192,7 +1192,7 @@ void Searcher::call_RAY_SLAVE_MODE_CONTIG_BIOLOGICAL_ABUNDANCES(){
 		// and it is as if we had requested it for real.
 		m_requestedCoverage=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages>0);
 		#endif
 	}
@@ -1323,7 +1323,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEARCHER_CLOSE(){
 	m_arrayOfFiles.clear();
 	m_arrayOfFiles_Buffer.clear();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_activeFiles==0);
 	#endif
 
@@ -1357,7 +1357,7 @@ void Searcher::browseColoredGraph(){
 		m_browsedTheGraphStarted=true;
 		m_currentVirtualColor=0;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(!m_waiting);
 		#endif /* ASSERT */
 
@@ -1408,7 +1408,7 @@ void Searcher::browseColoredGraph(){
 				}
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			int maximumPosition=MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit);
 			assert(position<=maximumPosition);
 			#endif /* ASSERT */
@@ -1527,7 +1527,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 		for(int i=0;i<(int)m_searchDirectories_size;i++){
 			for(int j=0;j<(int)m_searchDirectories[i].getSize();j++){
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(i<m_searchDirectories_size);
 				assert(j<m_searchDirectories[i].getSize());
 				#endif
@@ -1580,7 +1580,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 
 		m_pendingMessages--;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages==0);
 		#endif
 
@@ -1599,7 +1599,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 			m_createdSequenceReader=false;
 			m_requestedCoverage=false;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages==0);
 			#endif
 
@@ -1620,7 +1620,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 		// at this point, we have a valid iterator
 		}else{
 	
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages==0);
 			assert(m_sortedHitsIterator!=m_sortedHits.end());
 			#endif
@@ -1660,7 +1660,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 			messageBuffer[bufferPosition++]=m_sequenceIterator;
 			messageBuffer[bufferPosition++]=m_numberOfKmers;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(count > m_numberOfKmers){
 				cout<<"Error before sending, count= "<<count<<" m_numberOfKmers= "<<m_numberOfKmers<<endl;
 				cout<<"m_sequenceIterator= "<<m_sequenceIterator<<endl;
@@ -1835,7 +1835,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 			
 			showProcessedKmers();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_directoryIterator<m_searchDirectories_size);
 			assert(m_fileIterator<m_searchDirectories[m_directoryIterator].getSize());
 			#endif
@@ -1930,7 +1930,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 					m_sortedHits.push_back(hit);
 		
 					// the number of matches can not exceed the length
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(matches <= m_numberOfKmers);
 					#endif
 		
@@ -1945,7 +1945,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 					m_sortedHits.push_back(hit);
 					
 					// the number of matches can not exceed the length
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(matches <= m_numberOfKmers);
 					#endif
 		
@@ -1966,7 +1966,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 				buffer[bufferPosition++]=m_color;
 				buffer[bufferPosition++]=m_globalSequenceIterator;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_directoryIterator==(int)buffer[0]);
 				assert(m_fileIterator==(int)buffer[1]);
 				assert(m_sequenceIterator==(int)buffer[2]);
@@ -2009,20 +2009,20 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 
 				m_outbox->push_back(&aMessage);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_directoryIterator==(int)buffer[0]);
 				assert(m_fileIterator==(int)buffer[1]);
 				assert(m_sequenceIterator==(int)buffer[2]);
 				assert(m_outbox->size()>0);
 				#endif
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_pendingMessages==0);
 				#endif
 
 				m_pendingMessages++;
 				
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_pendingMessages==1);
 				#endif
 
@@ -2179,7 +2179,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 					m_outboxAllocator,
 					m_outbox,m_parameters->getRank());
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_pendingMessages>=0);
 				#endif
 			}
@@ -2198,7 +2198,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 			Message*message=m_inbox->at(0);
 			MessageUnit*buffer=message->getBuffer();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(message!=NULL);
 			#endif
 
@@ -2211,7 +2211,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 
 			m_pendingMessages--;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages==0);
 			#endif
 
@@ -2224,7 +2224,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 			cout<<"meta count= "<<count<<" period= "<<period<<endl;
 			#endif
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(count%period==0);
 			#endif
 
@@ -2281,7 +2281,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 
 					int numberOfPaths=buffer[bufferPosition++];
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 
 					int index=buffer[bufferPosition];
 					int total=buffer[bufferPosition+1];
@@ -2354,7 +2354,7 @@ void Searcher::call_RAY_SLAVE_MODE_SEQUENCE_BIOLOGICAL_ABUNDANCES(){
 						m_contigCounts[strand][contigPath].insert(theContigPosition);
 
 						// the number of matches can not exceed the length
-						#ifdef ASSERT
+						#ifdef CONFIG_ASSERT
 						assert((int)m_contigCounts[strand][contigPath].size()<= m_numberOfKmers);
 						#endif
 
@@ -2521,7 +2521,7 @@ string Searcher::getFileBaseName(int i,int j){
 	int theLength=file->length();
 	// .fasta is 6
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(theLength>0);
 	#endif
 
@@ -2563,7 +2563,7 @@ string Searcher::getBaseName(string a){
 		lastPosition--;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(lastPosition>=0);
 	assert(lastPosition!=0);
 	assert(a[lastPosition]!='/');
@@ -2590,7 +2590,7 @@ string Searcher::getBaseName(string a){
 	if(a[lastSlash]=='/'){
 		lastSlash++;
 	}else{
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(lastSlash==0);
 		#endif
 	}
@@ -2598,7 +2598,7 @@ string Searcher::getBaseName(string a){
 	// at this point, we have 2 positions
 	// from lastSlash to lastPosition inclusively,
 	// there is no slash.
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	for(int i=lastSlash;i<=lastPosition;i++){
 		if(a[i]=='/'){
 			cout<<"Input= "<<a<<" lastSlash= "<<lastSlash<<" lastPosition="<<lastPosition<<endl;
@@ -2616,7 +2616,7 @@ string Searcher::getBaseName(string a){
 
 	int count=lastPosition-lastSlash+1;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count>0);
 	#endif
 
@@ -2710,7 +2710,7 @@ void Searcher::call_RAY_MPI_TAG_GET_COVERAGE_AND_PATHS(Message*message){
 	cout<<"Capacity: "<<pathsThatCanBePacked<<" paths."<<endl;
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count%period==0);
 	#endif
 
@@ -2844,7 +2844,7 @@ void Searcher::call_RAY_MPI_TAG_GET_COVERAGE_AND_PATHS(Message*message){
 
 			while(pathIndex<(int)paths.size()){
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(pathIndex<(int)paths.size());
 				#endif
 
@@ -2886,7 +2886,7 @@ void Searcher::call_RAY_MPI_TAG_GET_COVERAGE_AND_PATHS(Message*message){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count*sizeof(MessageUnit)<=MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 	#endif
 
@@ -2959,7 +2959,7 @@ void Searcher::addColorToKmer(Vertex*node,PhysicalKmerColor color){
 	m_colorSet.incrementReferences(newVirtualColor);
 	m_colorSet.decrementReferences(virtualColorHandle);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_colorSet.virtualColorHasPhysicalColor(newVirtualColor,color));
 
 	// maybe this color was purged..
@@ -3060,7 +3060,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 		cout<<"m_colorSequenceKmersSlaveStarted := true"<<endl;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_bufferedData.isEmpty());
 		#endif
 
@@ -3098,7 +3098,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 	}else if(m_pendingMessages > 0 &&
 			m_inbox->hasMessage(RAY_MPI_TAG_ADD_KMER_COLOR_REPLY)){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages==1);
 		#endif
 
@@ -3108,7 +3108,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 
 		m_pendingMessages--;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pendingMessages==0);
 		#endif
 
@@ -3224,21 +3224,21 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 		// in the above code
 		}else if(!m_bufferedData.isEmpty()){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages==0);
 			#endif
 
 			m_pendingMessages+=m_bufferedData.flushAll(RAY_MPI_TAG_ADD_KMER_COLOR,m_outboxAllocator,
 				m_outbox,m_parameters->getRank());
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages>0);
 			#endif
 
 		// finished the file
 		}else if(m_pendingMessages==0){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_bufferedData.isEmpty());
 			#endif
 
@@ -3312,7 +3312,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 		cout<<"[phylogeny] identifier= "<<m_identifier<<endl;
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		//assert(m_pendingMessages==0); not used anymore
 		#endif
 
@@ -3327,7 +3327,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 		if( !m_searchDirectories[m_directoryIterator].hasNextKmer(m_kmerLength)){
 			
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_directoryIterator<m_searchDirectories_size);
 			assert(m_fileIterator<m_searchDirectories[m_directoryIterator].getSize());
 			#endif
@@ -3353,7 +3353,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 
 			bool gatheringKmers=true;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_pendingMessages==0);
 			#endif
 
@@ -3414,7 +3414,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 
 				int period=m_virtualCommunicator->getElementsPerQuery(RAY_MPI_TAG_ADD_KMER_COLOR);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(period == added);
 				#endif
 
@@ -3430,7 +3430,7 @@ void Searcher::call_RAY_SLAVE_MODE_ADD_COLORS(){
 					cout<<"flushed a message."<<endl;
 					#endif
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(m_pendingMessages>0);
 					assert(m_pendingMessages==1);
 					#endif
@@ -3539,13 +3539,13 @@ void Searcher::call_RAY_MPI_TAG_WRITE_SEQUENCE_ABUNDANCE_ENTRY(Message*message){
 		m_arrayOfFiles_tsv_Buffer[directoryIterator]=new ostringstream;
 
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeFiles>=0); // it is 0 or 1 or something else
 		#endif
 
 		m_activeFiles++;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeFiles>=1); 
 		#endif
 
@@ -3699,7 +3699,7 @@ void Searcher::call_RAY_MPI_TAG_WRITE_SEQUENCE_ABUNDANCE_ENTRY(Message*message){
 		#endif /* TEST_COLORED_AND_ASSEMBLED */
 
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_arrayOfFiles.count(directoryIterator)>0);
 		#endif
 
@@ -3730,15 +3730,15 @@ void Searcher::call_RAY_MPI_TAG_CONTIG_IDENTIFICATION(Message*message){
 
        	char strand=messageBuffer[bufferPosition++];
 
-       	#ifdef ASSERT
-       	assert(m_contigLengths.count(contig)>0);
+	#ifdef CONFIG_ASSERT
+	assert(m_contigLengths.count(contig)>0);
        	#endif
 
        	int kmerLength=m_parameters->getWordSize();
        	int contigLength=m_contigLengths[contig];
        	int count=messageBuffer[bufferPosition++];
 
-       	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
        	assert(kmerLength>0);
        	assert(contigLength>0);
        	assert(count>0);
@@ -3747,21 +3747,21 @@ void Searcher::call_RAY_MPI_TAG_CONTIG_IDENTIFICATION(Message*message){
        	int directoryIterator=messageBuffer[bufferPosition++];
        	int fileIterator=messageBuffer[bufferPosition++];
 
-       	#ifdef ASSERT
+       	#ifdef CONFIG_ASSERT
        	assert(directoryIterator<m_searchDirectories_size);
        	assert(fileIterator<m_searchDirectories[directoryIterator].getSize());
        	#endif
 
        	string category=m_fileNames[directoryIterator][fileIterator];
 
-       	int sequenceIterator=messageBuffer[bufferPosition++];
+	int sequenceIterator=messageBuffer[bufferPosition++];
 
        	int numberOfKmers=messageBuffer[bufferPosition++];
 
        	// the number of matches can not be greater than
        	// the number of k-mers in the query sequence
        	// otherwise, it does not make sense
-       	#ifdef ASSERT
+       	#ifdef CONFIG_ASSERT
        	if(count> numberOfKmers){
        		cout<<"Error: "<<count<<" k-mers observed, but the contig has only "<<numberOfKmers<<endl;
        		cout<<"Sequence= "<<sequenceIterator<<endl;
@@ -3848,7 +3848,7 @@ LargeCount Searcher::getTotalNumberOfKmerObservations(){
 void Searcher::flushSequenceAbundanceXMLBuffer(int directoryIterator,bool force){
 
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_arrayOfFiles_Buffer.count(directoryIterator)>0);
 	assert(m_arrayOfFiles.count(directoryIterator)>0);
 	#endif
@@ -3865,7 +3865,7 @@ void Searcher::flushSequenceAbundanceXMLBuffer(int directoryIterator,bool force)
 
 void Searcher::flushContigIdentificationBuffer(int directoryIterator,bool force){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_identificationFiles.count(directoryIterator)>0);
 	assert(m_identificationFiles_Buffer.count(directoryIterator)>0);
 	#endif
@@ -3886,7 +3886,7 @@ void Searcher::call_RAY_MPI_TAG_VIRTUAL_COLOR_DATA(Message*message){
 
 	MessageUnit*buffer=(MessageUnit*)message->getBuffer();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int count=message->getCount();
 	assert(count>0);
 	#endif /* ASSERT */
@@ -4016,13 +4016,13 @@ void Searcher::generateSummaryOfColoredDeBruijnGraph(){
 		if(references==0)
 			continue;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		int numberOfPhysicalColors=m_masterColorSet.getNumberOfPhysicalColors(currentVirtualColor);
 		#endif
 
 		set<PhysicalKmerColor>*colors=m_masterColorSet.getPhysicalColors(currentVirtualColor);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(numberOfPhysicalColors>0);
 		#endif /* ASSERT */
 
@@ -4052,7 +4052,7 @@ void Searcher::generateSummaryOfColoredDeBruijnGraph(){
 			PhysicalKmerColor physicalColor=getColorInNamespace(handle);
 			classifiedData[aNamespace].insert(physicalColor);
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(classifiedData.count(aNamespace)>0);
 			#endif /* ASSERT */
 		}
diff --git a/code/Searcher/VirtualKmerColor.cpp b/code/Searcher/VirtualKmerColor.cpp
index 0c28240..2fee8fa 100644
--- a/code/Searcher/VirtualKmerColor.cpp
+++ b/code/Searcher/VirtualKmerColor.cpp
@@ -23,7 +23,7 @@
 
 #include <iostream>
 using namespace std;
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 #include <assert.h>
 #endif
 
@@ -37,11 +37,11 @@ void VirtualKmerColor::clear(){
 	m_colors.clear();
 	m_hash=0;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getNumberOfReferences()==0);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(getNumberOfPhysicalColors()==0);
 	#endif
 }
@@ -53,14 +53,14 @@ void VirtualKmerColor::incrementReferences(){
 void VirtualKmerColor::decrementReferences(){
 	m_references--;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_references>=0);
 	#endif
 }
 
 void VirtualKmerColor::addPhysicalColor(PhysicalKmerColor color){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(!hasPhysicalColor(color));
 	#endif
 
diff --git a/code/SeedExtender/BubbleTool.cpp b/code/SeedExtender/BubbleTool.cpp
index f2cf6d9..18ba1b1 100644
--- a/code/SeedExtender/BubbleTool.cpp
+++ b/code/SeedExtender/BubbleTool.cpp
@@ -44,7 +44,7 @@ map<Kmer,int>*coverages){
 	for(int j=0;j<(int)trees->size();j++){
 		for(int i=0;i<(int)trees->at(j).size();i+=2){
 			Kmer a=trees->at(j).at(i+0);
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(i+1<(int)trees->at(j).size());
 			#endif
 			Kmer b=trees->at(j).at(i+1);
@@ -72,7 +72,7 @@ map<Kmer ,int>*coverages,int repeatCoverage){
 	}
 
 	int m_wordSize=m_parameters->getWordSize();
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	for(int i=0;i<(int)trees->size();i++){
 		for(int j=0;j<(int)trees->at(i).size();j+=2){
 			Kmer a=trees->at(i).at(j+0);
@@ -105,7 +105,7 @@ map<Kmer ,int>*coverages,int repeatCoverage){
 	for(int j=0;j<(int)trees->size();j++){
 		for(int i=0;i<(int)trees->at(j).size();i+=2){
 			Kmer a=trees->at(j).at(i+1);
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(coverages->count(a)==0){
 				cout<<a.idToWord(m_parameters->getWordSize(),m_parameters->getColorSpaceMode())<<" has no coverage."<<endl;
 			}
@@ -132,11 +132,11 @@ map<Kmer ,int>*coverages,int repeatCoverage){
 		return false;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(coverages->count(root)>0);
 	assert(coverages->count(target)>0);
 	#endif
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int rootCoverage=(*coverages)[root];
 	int targetCoverage=(*coverages)[target];
 	assert(rootCoverage>0);
diff --git a/code/SeedExtender/DepthFirstSearchData.cpp b/code/SeedExtender/DepthFirstSearchData.cpp
index 8f0167d..06dba9b 100644
--- a/code/SeedExtender/DepthFirstSearchData.cpp
+++ b/code/SeedExtender/DepthFirstSearchData.cpp
@@ -97,7 +97,7 @@ void DepthFirstSearchData::depthFirstSearch(Kmer root,Kmer a,int maxDepth,
 			}else if((*edgesReceived)){
 				Kmer vertexToVisit=m_depthFirstSearchVerticesToVisit.top();
 				int theDepth=m_depthFirstSearchDepths.top();
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(theDepth>=0);
 				assert(theDepth<=maxDepth);
 				#endif
@@ -152,7 +152,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
  int*receivedVertexCoverage,SeedingData*seedingData,
 		int minimumCoverage,bool*edgesReceived,Parameters*parameters){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int wordSize=parameters->getWordSize();
 	#endif
 
@@ -203,7 +203,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
 			if(!(*edgesRequested)){
 				m_coverages[vertexToVisit]=(*receivedVertexCoverage);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_depthFirstSearchVisitedVertices.count(vertexToVisit)>0){
 					cout<<"Already visited: "<<vertexToVisit.idToWord(wordSize,parameters->getColorSpaceMode())<<" root is "<<a.idToWord(wordSize,parameters->getColorSpaceMode())<<endl;
 				}
@@ -214,7 +214,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
 				if((*receivedVertexCoverage)>0){
 					m_depthFirstSearchVisitedVertices.insert(vertexToVisit);
 				}else{
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(false);
 					#endif
 					// don't visit it.
@@ -244,7 +244,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
 				Kmer vertexToVisit=m_depthFirstSearchVerticesToVisit.top();
 				int theDepth=m_depthFirstSearchDepths.top();
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 	
 				assert(theDepth>=0);
 				assert(theDepth<=maxDepth);
@@ -284,7 +284,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
 					m_depthFirstSearchVisitedVertices_depths.push_back(newDepth);
 				}
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_outgoingEdges.count(vertexToVisit)>0){
 					cout<<vertexToVisit.idToWord(wordSize,parameters->getColorSpaceMode())<<" is already in the data structure "<<m_outgoingEdges[vertexToVisit].size()<<" v. "<<outgoingEdges.size()<<endl;
 				}
@@ -320,7 +320,7 @@ void DepthFirstSearchData::depthFirstSearchBidirectional(Kmer a,int maxDepth,
 				(*edgesRequested)=false;
 				(*vertexCoverageRequested)=false;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_ingoingEdges.count(vertexToVisit)==0);
 	
 				#endif
diff --git a/code/SeedExtender/Direction.cpp b/code/SeedExtender/Direction.cpp
index 934e7fd..12cb813 100644
--- a/code/SeedExtender/Direction.cpp
+++ b/code/SeedExtender/Direction.cpp
@@ -43,7 +43,7 @@ Direction*Direction::getNext(){
 }
 
 void Direction::setNext(Direction*e){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(this!=NULL);
 
 	if(e!=NULL){
diff --git a/code/SeedExtender/ReadFetcher.cpp b/code/SeedExtender/ReadFetcher.cpp
index 5337eef..3bb1151 100644
--- a/code/SeedExtender/ReadFetcher.cpp
+++ b/code/SeedExtender/ReadFetcher.cpp
@@ -57,6 +57,10 @@ void ReadFetcher::work(){
 	}
 	if(!m_readsRequested){
 		MessageUnit*message2=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+
+#ifdef CONFIG_ASSERT
+		assert(message2 != NULL);
+#endif
 		int bufferPosition=0;
 		m_vertex.pack(message2,&bufferPosition);
 
@@ -69,10 +73,14 @@ void ReadFetcher::work(){
 
 		// do some padding
 		while(bufferPosition<period){
+
+#ifdef CONFIG_ASSERT
+			assert(bufferPosition * sizeof(MessageUnit) < MAXIMUM_MESSAGE_SIZE_IN_BYTES);
+#endif
 			message2[bufferPosition++]=0;
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		int start=KMER_U64_ARRAY_SIZE+1;
 	
 		assert(period>=5);
@@ -112,7 +120,7 @@ void ReadFetcher::work(){
 		vector<MessageUnit> buffer;
 		m_virtualCommunicator->getMessageResponseElements(m_workerId,&buffer);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		int period=m_virtualCommunicator->getElementsPerQuery(RAY_MPI_TAG_REQUEST_VERTEX_READS);
 		assert((int)buffer.size()==period);
 		#endif
@@ -138,7 +146,7 @@ void ReadFetcher::work(){
 
 		if(rank!=INVALID_RANK){
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(!(rank>=0&&rank<m_parameters->getSize())){
 				cout<<"Error rank="<<rank<<endl;
 				cout<<"Buffer: ";
@@ -154,7 +162,7 @@ void ReadFetcher::work(){
 			int position=buffer[3];
 			char strand=(char)buffer[4];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			int destination=m_parameters->vertexRank(&m_vertex);
 
 			assert(readIndex>=0);
diff --git a/code/SeedExtender/SeedExtender.cpp b/code/SeedExtender/SeedExtender.cpp
index c0c1b59..5f6ea54 100644
--- a/code/SeedExtender/SeedExtender.cpp
+++ b/code/SeedExtender/SeedExtender.cpp
@@ -205,7 +205,7 @@ bool*vertexCoverageReceived,int size,int*receivedVertexCoverage,Chooser*chooser,
 				(*vertexCoverageReceived)=true;
 				(*receivedVertexCoverage)=*(m_cache.find(kmer,false)->getValue());
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert((CoverageDepth)(*receivedVertexCoverage)<=m_parameters->getMaximumAllowedCoverage());
 				#endif
 
@@ -214,7 +214,7 @@ bool*vertexCoverageReceived,int size,int*receivedVertexCoverage,Chooser*chooser,
 				(*vertexCoverageReceived)=true;
 				(*receivedVertexCoverage)=*(m_cache.find(reverseComplement,false)->getValue());
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert((CoverageDepth)(*receivedVertexCoverage)<=m_parameters->getMaximumAllowedCoverage());
 				#endif
 
@@ -242,7 +242,7 @@ bool*vertexCoverageReceived,int size,int*receivedVertexCoverage,Chooser*chooser,
 
 				CoverageDepth coverageValue=*receivedVertexCoverage;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 
 				if(coverageValue==0){
 					Rank dest=m_parameters->vertexRank(&kmer);
@@ -293,7 +293,7 @@ bool*vertexCoverageReceived,int size,int*receivedVertexCoverage,Chooser*chooser,
 			ed->m_EXTENSION_pairedLibrariesForVertices.clear();
 			ed->m_EXTENSION_pairedReadsForVertices.clear();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(ed->m_EXTENSION_coverages.size()==ed->m_enumerateChoices_outgoingEdges.size());
 			#endif
 		}
@@ -352,7 +352,7 @@ int*receivedVertexCoverage,bool*edgesReceived,vector<Kmer>*receivedOutgoingEdges
 				ReadHandle uniqueId=*(ed->m_EXTENSION_readIterator);
 				ExtensionElement*element=ed->getUsedRead(uniqueId);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(element!=NULL);
 				#endif
 
@@ -379,14 +379,14 @@ Presently, insertions or deletions up to 8 are supported.
 				int currentPosition=ed->m_EXTENSION_extension.size();
 				int distance=currentPosition-startPosition+element->getStrandPosition();
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(startPosition<(int)ed->m_extensionCoverageValues.size());
 				#endif
 
 				element->getSequence(m_receivedString,m_parameters);
 				char*theSequence=m_receivedString;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(theSequence!=NULL);
 				#endif
 
@@ -398,7 +398,7 @@ Presently, insertions or deletions up to 8 are supported.
 					cout<<ed->m_EXTENSION_receivedLength<<", k-mer length: ";
 					cout<<wordSize<<endl;
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(false);
 					#endif
 
@@ -409,7 +409,7 @@ Presently, insertions or deletions up to 8 are supported.
 
 				char theRightStrand=element->getStrand();
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(theRightStrand=='R'||theRightStrand=='F');
 				assert(element->getType()==TYPE_SINGLE_END||element->getType()==TYPE_RIGHT_END||element->getType()==TYPE_LEFT_END);
 				#endif
@@ -581,7 +581,7 @@ Presently, insertions or deletions up to 8 are supported.
 						m_ed->m_pairedReadsWithoutMate.erase(uniqueId);
 
 						// free the sequence
-						#ifdef ASSERT
+						#ifdef CONFIG_ASSERT
 						if(element==NULL){
 							cout<<"element "<<uniqueId<<" not found now="<<m_ed->m_EXTENSION_extension.size()-1<<""<<endl;
 						}
@@ -639,7 +639,7 @@ Presently, insertions or deletions up to 8 are supported.
 						cout<<"Selection: "<<choice+1<<endl;
 					}
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(choice<(int)ed->m_enumerateChoices_outgoingEdges.size());
 					#endif
 
@@ -692,7 +692,7 @@ size,theRank,outbox,receivedVertexCoverage,receivedOutgoingEdges,minimumCoverage
 	m_parameters);
 					}
 				}else{
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					assert(!m_dfsData->m_depthFirstSearchVisitedVertices_vector.empty());
 					#endif
 
@@ -862,7 +862,7 @@ size,theRank,outbox,receivedVertexCoverage,receivedOutgoingEdges,minimumCoverage
 			if(verbose)
 				cout<<"Rank "<<m_parameters->getRank()<<" is changing direction."<<endl;
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_complementedSeed.size() == (int)ed->m_EXTENSION_extension.size());
 			#endif
 
@@ -930,11 +930,11 @@ map<Kmer,set<Kmer> >*arcs,map<Kmer,int>*coverages,int depth,set<Kmer>*visited){
 			printf(" ");
 		Kmer child=*i;
 		string s=child.idToWord(m_parameters->getWordSize(),m_parameters->getColorSpaceMode());
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(coverages->count(*i)>0);
 		#endif
 		int coverage=(*coverages)[*i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(coverages>0);
 		#endif
 		printf("%s coverage: %i depth: %i\n",s.c_str(),coverage,depth);
@@ -1336,7 +1336,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 
 				m_currentPeakCoverage=m_ed->m_EXTENSION_currentSeed.getPeakCoverage();
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_currentPeakCoverage>=2);
 				#endif
 
@@ -1357,7 +1357,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 		PathHandle waveId=getPathUniqueId(theRank,ed->m_EXTENSION_currentSeedIndex);
 
 		// save wave progress.
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert((int)getIdFromPathUniqueId(waveId)==ed->m_EXTENSION_currentSeedIndex);
 		assert((int)getRankFromPathUniqueId(waveId)==theRank);
 		assert(theRank<size);
@@ -1453,7 +1453,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 		ed->m_EXTENSION_extension.push_back((currentVertex));
 		ed->m_extensionCoverageValues.push_back(*receivedVertexCoverage);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(ed->m_currentCoverage > m_parameters->getMaximumAllowedCoverage())
 			cout<<"Error: m_currentCoverage= "<<ed->m_currentCoverage<<" getMaximumAllowedCoverage: "<<m_parameters->getMaximumAllowedCoverage()<<endl;
 		assert(ed->m_currentCoverage<=m_parameters->getMaximumAllowedCoverage());
@@ -1563,7 +1563,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 
 				SplayNode<ReadHandle,Read>*node=m_cacheForRepeatedReads.find(uniqueId,false);
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(node!=NULL);
 				#endif
 
@@ -1576,7 +1576,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 					pr=&dummy;
 				}
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(pr!=NULL);
 				#endif
 				ed->m_EXTENSION_pairedRead=*pr;
@@ -1591,7 +1591,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 				m_sequenceRequested=true;
 				m_sequenceReceived=false;
 				int sequenceRank=ed->m_EXTENSION_receivedReads[m_sequenceIndexToCache].getRank();
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(sequenceRank>=0);
 				assert(sequenceRank<size);
 				#endif
@@ -1725,7 +1725,7 @@ BubbleData*bubbleData,int minimumCoverage,OpenAssemblerChooser*oa,int wordSize,v
 
 					MACRO_COLLECT_PROFILING_INFORMATION();
 
-					#ifdef ASSERT
+					#ifdef CONFIG_ASSERT
 					element->getSequence(m_receivedString,m_parameters);
 					assert(readLength==(int)strlen(m_receivedString));
 					#endif
@@ -1870,7 +1870,7 @@ void SeedExtender::configureTheBeautifulHotSkippingTechnology(){
 }
 
 void SeedExtender::inspect(ExtensionData*ed,Kmer*currentVertex){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(ed->m_enumerateChoices_outgoingEdges.size()==ed->m_EXTENSION_coverages.size());
 	#endif
 
@@ -1879,7 +1879,7 @@ void SeedExtender::inspect(ExtensionData*ed,Kmer*currentVertex){
 	cout<<endl;
 	cout<<"*****************************************"<<endl;
 	cout<<"CurrentVertex="<<currentVertex->idToWord(wordSize,m_parameters->getColorSpaceMode())<<" @"<<ed->m_EXTENSION_extension.size()<<endl;
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(ed->m_currentCoverage<=m_parameters->getMaximumAllowedCoverage());
 	#endif
 	cout<<"Coverage="<<ed->m_currentCoverage<<endl;
@@ -1895,7 +1895,7 @@ void SeedExtender::inspect(ExtensionData*ed,Kmer*currentVertex){
 		cout<<endl;
 		cout<<"Choice #"<<i+1<<endl;
 		cout<<"Vertex: "<<vertex<<endl;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(i>=(int)ed->m_EXTENSION_coverages.size()){
 			cout<<"Error: i="<<i<<" Size="<<ed->m_EXTENSION_coverages.size()<<endl;
 		}
@@ -2093,7 +2093,7 @@ void SeedExtender::readCheckpoint(FusionData*fusionData){
 	cout<<"Rank "<<m_parameters->getRank()<<" is reading checkpoint Extensions"<<endl;
 	ifstream f(m_parameters->getCheckpointFile("Extensions").c_str());
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ed->m_EXTENSION_contigs.size()==0);
 	#endif
 
@@ -2103,7 +2103,7 @@ void SeedExtender::readCheckpoint(FusionData*fusionData){
 	for(int i=0;i<count;i++){
 		int length=0;
 		f.read((char*)&length,sizeof(int));
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(length>0);
 		#endif
 		GraphPath extension;
@@ -2125,7 +2125,7 @@ void SeedExtender::readCheckpoint(FusionData*fusionData){
 
 	cout<<"Rank "<<m_parameters->getRank()<<" loaded "<<count<<" extensions from checkpoint Extensions"<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count==(int)m_ed->m_EXTENSION_contigs.size());
 	assert(m_ed->m_EXTENSION_identifiers.size()==m_ed->m_EXTENSION_contigs.size());
 	#endif
@@ -2246,7 +2246,7 @@ void SeedExtender::processExpiredReads(){
 
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(element!=NULL);
 		#endif
 
@@ -2255,7 +2255,7 @@ void SeedExtender::processExpiredReads(){
 		if(read==NULL){
 			continue;
 		}
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(read!=NULL);
 		#endif
 
@@ -2276,7 +2276,7 @@ void SeedExtender::printSeed(){
 
 	int position=m_ed->m_EXTENSION_currentSeed.size()-1;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(position>=0);
 	#endif
 
@@ -2375,7 +2375,7 @@ int SeedExtender::chooseWithSeed(){
 
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_ed->m_EXTENSION_coverages.size()==m_ed->m_enumerateChoices_outgoingEdges.size());
 		#endif
 
@@ -2392,7 +2392,7 @@ int SeedExtender::chooseWithSeed(){
 		//int last=100;
 		int position=m_ed->m_EXTENSION_extension.size()-1;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(position>=0);
 		#endif
 
@@ -2418,7 +2418,7 @@ int SeedExtender::chooseWithSeed(){
 
 		cout<<"Exiting..."<<endl;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(false);
 		#endif
 	}
@@ -2467,7 +2467,7 @@ void SeedExtender::finalizeExtensions(vector<GraphPath>*seeds,FusionData*fusionD
 		fusionData->m_FUSION_identifier_map[id]=i;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_ed->m_EXTENSION_identifiers.size()==m_ed->m_EXTENSION_contigs.size());
 	#endif
 
@@ -2554,7 +2554,7 @@ void SeedExtender::call_RAY_MPI_TAG_ASK_IS_ASSEMBLED(Message*message){
 
 	Rank origin=incoming[pos++];
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	Vertex*node=m_subgraph->find(&vertex);
 	assert(node!=NULL);
 	#endif
@@ -2611,7 +2611,7 @@ void SeedExtender::call_RAY_MPI_TAG_ADD_GRAPH_PATH(Message*message){
 		string file=fileName.str();
 		m_pathFile.open(file.c_str(),ios_base::app);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_pathFile.is_open());
 		#endif
 
diff --git a/code/SeedExtender/VertexMessenger.cpp b/code/SeedExtender/VertexMessenger.cpp
index 5add909..eea43b5 100644
--- a/code/SeedExtender/VertexMessenger.cpp
+++ b/code/SeedExtender/VertexMessenger.cpp
@@ -62,7 +62,7 @@ void VertexMessenger::work(){
 			int strandPosition=buffer[5+4*i+2];
 			char strand=buffer[5+4*i+3];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(theRank>=0);
 			if(theRank>=m_parameters->getSize()){
 				cout<<"Rank="<<theRank<<" Size="<<m_parameters->getSize()<<endl;
@@ -136,7 +136,7 @@ void VertexMessenger::getReadsForRepeatedVertex(){
 			int strandPosition=buffer[1+4*i+2];
 			char strand=buffer[1+4*i+3];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(theRank>=0);
 			if(theRank>=m_parameters->getSize()){
 				cout<<"Rank="<<theRank<<" Size="<<m_parameters->getSize()<<endl;
@@ -180,7 +180,7 @@ void VertexMessenger::getReadsForUniqueVertex(){
 			int strandPosition=buffer[1+4*i+2];
 			char strand=buffer[1+4*i+3];
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(theRank>=0);
 			if(theRank>=m_parameters->getSize()){
 				cout<<"Rank="<<theRank<<" Size="<<m_parameters->getSize()<<endl;
diff --git a/code/SeedingData/PathHandle.cpp b/code/SeedingData/PathHandle.cpp
index 5398a55..e037a83 100644
--- a/code/SeedingData/PathHandle.cpp
+++ b/code/SeedingData/PathHandle.cpp
@@ -20,7 +20,12 @@
 
 #include "PathHandle.h"
 
+#include <fstream>
+#include <iostream>
+using namespace std;
+
 #include <string.h>
+#include <stdint.h>
 
 void PathHandle::operator=(const PathHandle &b) {
 	m_value = b.m_value;
@@ -62,13 +67,23 @@ uint64_t PathHandle::operator / (uint64_t value) {
 	return m_value / value;
 }
 
-ostream & operator >>(ostream & stream, const PathHandle & handle) {
-	stream >> handle.m_value;
+void PathHandle::setValue(uint64_t value) {
+	m_value = value;
+}
+
+istream & operator >>(istream & stream, PathHandle & handle) {
+
+	uint64_t myValue = 0;
+	stream >> myValue;
+	handle.setValue(myValue);
+
 	return stream;
 }
 
 ostream & operator <<(ostream & stream, const PathHandle & handle) {
-	stream << handle.m_value;
+
+	stream << handle.getValue();
+
 	return stream;
 }
 
diff --git a/code/SeedingData/PathHandle.h b/code/SeedingData/PathHandle.h
index 6c29b36..62f9265 100644
--- a/code/SeedingData/PathHandle.h
+++ b/code/SeedingData/PathHandle.h
@@ -24,7 +24,7 @@
 
 #include <RayPlatform/store/CarriageableItem.h>
 
-#include <ostream>
+#include <iostream>
 using namespace std;
 
 #include <stdint.h>
@@ -34,6 +34,7 @@ using namespace std;
  */
 class PathHandle : public CarriageableItem {
 
+private:
 	uint64_t m_value;
 
 public:
@@ -55,8 +56,13 @@ public:
 	uint64_t operator + (uint64_t value);
 	uint64_t operator % (uint64_t value);
 
+	void setValue(uint64_t value);
+
+	// add these 2 as friends.
+	/*
 	friend ostream & operator <<(ostream & stream, const PathHandle & handle);
 	friend ostream & operator >>(ostream & stream, const PathHandle & handle);
+	*/
 
 	const uint64_t & getValue() const;
 	uint64_t & getValue();
@@ -64,6 +70,13 @@ public:
 	int load(const char * buffer);
 	int dump(char * buffer) const;
 	int getRequiredNumberOfBytes() const;
+
 };
 
+/**
+ * prototype for operators.
+ */
+ostream & operator <<(ostream & stream, const PathHandle & handle);
+istream & operator >>(istream & stream, PathHandle & handle);
+
 #endif
diff --git a/code/SeedingData/SeedWorker.cpp b/code/SeedingData/SeedWorker.cpp
index 1dca517..bee34f8 100644
--- a/code/SeedingData/SeedWorker.cpp
+++ b/code/SeedingData/SeedWorker.cpp
@@ -301,7 +301,7 @@ void SeedWorker::constructor(Kmer*key,Parameters*parameters,RingAllocator*outbox
 	m_wordSize=parameters->getWordSize();
 	m_parameters=parameters;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_wordSize!=0);
 #endif
 
@@ -387,7 +387,7 @@ void SeedWorker::do_1_1_test(){
 			m_ingoingCoverages.clear();
 			m_outgoingCoverages.clear();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(m_SEEDING_receivedIngoingEdges.size()>4){
 				cout<<"size="<<m_SEEDING_receivedIngoingEdges.size()<<endl;
 			}
diff --git a/code/SeedingData/SeedingData.cpp b/code/SeedingData/SeedingData.cpp
index 884f8cc..f2e0ac3 100644
--- a/code/SeedingData/SeedingData.cpp
+++ b/code/SeedingData/SeedingData.cpp
@@ -55,7 +55,7 @@ void SeedingData::call_RAY_SLAVE_MODE_START_SEEDING(){
 		m_initiatedIterator=true;
 		m_maximumAliveWorkers=32768;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		m_splayTreeIterator.hasNext();
 		#endif
 
@@ -89,7 +89,7 @@ void SeedingData::call_RAY_SLAVE_MODE_START_SEEDING(){
 	// 1. iterate on active workers
 	if(m_activeWorkerIterator!=m_activeWorkers.end()){
 		WorkerHandle workerId=*m_activeWorkerIterator;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_aliveWorkers.count(workerId)>0);
 		assert(!m_aliveWorkers[workerId].isDone());
 		#endif
@@ -107,13 +107,19 @@ void SeedingData::call_RAY_SLAVE_MODE_START_SEEDING(){
 			m_workersDone.push_back(workerId);
 			GraphPath*seed=m_aliveWorkers[workerId].getSeed();
 
+			int minimalSeedLength = 100;
+
+			if(m_parameters->hasConfigurationOption("-minimum-seed-length", 1)) {
+				minimalSeedLength = m_parameters->getConfigurationInteger("-minimum-seed-length", 0);
+			}
+
 			int nucleotides=getNumberOfNucleotides(seed->size(),m_wordSize);
 
 			if(seed->size() > 0 && m_debugSeeds){
 				cout<<"Raw seed length: "<<nucleotides<<" nucleotides"<<endl;
 			}
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(nucleotides==0 || nucleotides>=m_wordSize);
 			#endif
 
@@ -138,12 +144,13 @@ void SeedingData::call_RAY_SLAVE_MODE_START_SEEDING(){
 				m_skippedObjectsWithBubbleWeakComponent++;
 
 			// only consider the long ones.
-			}else if(nucleotides>=m_parameters->getMinimumContigLength()){
+			}else if(nucleotides >= minimalSeedLength){
+
 				#ifdef SHOW_DISCOVERIES
 				printf("Rank %i discovered a seed with %i vertices\n",m_rank,(int)seed.size());
 				#endif
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(seed->size()>0);
 				#endif
 
@@ -226,7 +233,7 @@ void SeedingData::call_RAY_SLAVE_MODE_START_SEEDING(){
 					}
 				}
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_SEEDING_i==0){
 					assert(m_completedJobs==0&&m_activeWorkers.size()==0&&m_aliveWorkers.size()==0);
 				}
@@ -261,7 +268,7 @@ RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE
 		m_activeWorkerIterator=m_activeWorkers.begin();
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((int)m_aliveWorkers.size()<=m_maximumAliveWorkers);
 	#endif
 
@@ -282,7 +289,7 @@ RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE
 		cout<<"Rank "<<m_rank<<" Skipped paths because of low coverage: "<<m_skippedNotEnoughCoverage<<endl;
 		cout<<"Rank "<<m_rank<<" Eligible paths: "<<m_eligiblePaths<<endl;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_eligiblePaths==(int)m_SEEDING_seeds.size());
 		#endif
 
@@ -294,7 +301,7 @@ RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE
 			showMemoryUsage(m_rank);
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_aliveWorkers.size()==0);
 		assert(m_activeWorkers.size()==0);
 		#endif
@@ -340,7 +347,7 @@ int*mode,
 	m_mode=mode;
 	m_parameters=parameters;
 	m_wordSize=m_parameters->getWordSize();
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_wordSize>=15&&m_wordSize<=CONFIG_MAXKMERLENGTH);
 	#endif
 	m_subgraph=subgraph;
@@ -372,7 +379,7 @@ void SeedingData::updateStates(){
 	for(int i=0;i<(int)m_workersDone.size();i++){
 		WorkerHandle workerId=m_workersDone[i];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		assert(m_aliveWorkers.count(workerId)>0);
 		#endif
@@ -385,7 +392,7 @@ void SeedingData::updateStates(){
 
 	for(int i=0;i<(int)m_waitingWorkers.size();i++){
 		WorkerHandle workerId=m_waitingWorkers[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.count(workerId)>0);
 		#endif
 		m_activeWorkers.erase(workerId);
diff --git a/code/SequencesIndexer/IndexerWorker.cpp b/code/SequencesIndexer/IndexerWorker.cpp
index 8027d7c..b59b852 100644
--- a/code/SequencesIndexer/IndexerWorker.cpp
+++ b/code/SequencesIndexer/IndexerWorker.cpp
@@ -67,7 +67,7 @@ bool IndexerWorker::isDone(){
 void IndexerWorker::work(){
 	Read*read=m_reads->at(m_workerId);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(read!=NULL);
 	#endif
 
@@ -249,14 +249,14 @@ void IndexerWorker::work(){
 
 	}else{
 		if(m_parameters->hasOption("-write-read-markers")){
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_readMarkerFile != NULL);
 			#endif
 
 			// append read marker information to a file.
 			(*m_readMarkerFile)<<m_sequenceId<<" Count: "<<m_coverages.size();
 
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_workerId < (int)m_reads->size());
 			#endif
 
@@ -281,14 +281,14 @@ void IndexerWorker::work(){
 		}
 
 		if(m_parameters->hasOption("-write-marker-summary")){
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_workerId < (int)m_reads->size());
 			#endif
 
 			int forwardOffset = m_reads->at(m_workerId)->getForwardOffset();
 
 			if(forwardOffset < m_coverages.size() && m_coverages.size() > 0){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_coverages.size() > 0);
 				#endif
 
@@ -302,7 +302,7 @@ void IndexerWorker::work(){
 			int reverseOffset = m_reads->at(m_workerId)->getReverseOffset();
 
 			if(reverseOffset < m_coverages.size() && m_coverages.size() > 0){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_coverages.size() > 0);
 				#endif
 
diff --git a/code/SequencesIndexer/SequencesIndexer.cpp b/code/SequencesIndexer/SequencesIndexer.cpp
index a72b67c..b7a4908 100644
--- a/code/SequencesIndexer/SequencesIndexer.cpp
+++ b/code/SequencesIndexer/SequencesIndexer.cpp
@@ -67,7 +67,7 @@ void SequencesIndexer::call_RAY_SLAVE_MODE_INDEX_SEQUENCES(){
 	if(m_activeWorkerIterator.hasNext()){
 		WorkerHandle workerId=m_activeWorkerIterator.next()->getKey();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_aliveWorkers.find(workerId,false)!=NULL);
 		assert(!m_aliveWorkers.find(workerId,false)->getValue()->isDone());
 		#endif
@@ -106,7 +106,7 @@ void SequencesIndexer::call_RAY_SLAVE_MODE_INDEX_SEQUENCES(){
 						showMemoryUsage(m_rank);
 				}
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_theSequenceId==0){
 					assert(m_completedJobs==0&&m_activeWorkers.size()==0&&m_aliveWorkers.size()==0);
 				}
@@ -137,7 +137,7 @@ void SequencesIndexer::call_RAY_SLAVE_MODE_INDEX_SEQUENCES(){
 		m_activeWorkerIterator.constructor(&m_activeWorkers);
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert((int)m_aliveWorkers.size()<=m_maximumAliveWorkers);
 	#endif
 
@@ -156,7 +156,7 @@ void SequencesIndexer::call_RAY_SLAVE_MODE_INDEX_SEQUENCES(){
 			showMemoryUsage(m_rank);
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_aliveWorkers.size()==0);
 		assert(m_activeWorkers.size()==0);
 		#endif
@@ -261,7 +261,7 @@ void SequencesIndexer::updateStates(){
 	// erase completed jobs
 	for(int i=0;i<(int)m_workersDone.size();i++){
 		WorkerHandle workerId=m_workersDone[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.find(workerId,false)!=NULL);
 		assert(m_aliveWorkers.find(workerId,false)!=NULL);
 		#endif
@@ -273,7 +273,7 @@ void SequencesIndexer::updateStates(){
 
 	for(int i=0;i<(int)m_waitingWorkers.size();i++){
 		WorkerHandle workerId=m_waitingWorkers[i];
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_activeWorkers.find(workerId,false)!=NULL);
 		#endif
 		m_activeWorkers.remove(workerId,true,&m_workAllocator);
diff --git a/code/SequencesLoader/ArrayOfReads.cpp b/code/SequencesLoader/ArrayOfReads.cpp
index 830cc86..fd854ca 100644
--- a/code/SequencesLoader/ArrayOfReads.cpp
+++ b/code/SequencesLoader/ArrayOfReads.cpp
@@ -27,7 +27,7 @@
 using namespace std;
 
 void ArrayOfReads::constructor(MyAllocator*allocator){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(allocator!=NULL);
 	#endif
 	m_allocator=allocator;
@@ -39,7 +39,7 @@ void ArrayOfReads::constructor(MyAllocator*allocator){
 	for(int i=0;i<m_maxNumberOfChunks;i++)
 		m_chunks[i]=NULL;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_chunks!=NULL);
 	#endif
 
@@ -49,27 +49,27 @@ void ArrayOfReads::constructor(MyAllocator*allocator){
 }
 
 void ArrayOfReads::push_back(Read*a){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 	if(m_elements==m_maxSize){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_numberOfChunks!=m_maxNumberOfChunks);
 		#endif
 
 		m_maxSize+=m_CHUNK_SIZE;
 		m_numberOfChunks++;
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_numberOfChunks!=0);
 		#endif
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_chunks!=NULL);
 		#endif
 
 		m_chunks[m_numberOfChunks-1]=(Read*)m_allocator->allocate(m_CHUNK_SIZE*sizeof(Read));
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_chunks[m_numberOfChunks-1]!=NULL);
 		assert(m_elements<m_maxSize);
 		assert(m_numberOfChunks!=0);
@@ -77,7 +77,7 @@ void ArrayOfReads::push_back(Read*a){
 		#endif
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elements!=m_maxSize);
 	assert(m_maxSize!=0);
 	if(m_numberOfChunks==0){
@@ -90,7 +90,7 @@ void ArrayOfReads::push_back(Read*a){
 	Read*b=at(m_elements-1);
 	*b=*a;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_elements<=m_maxSize);
 	assert(m_elements!=0);
 	assert(m_maxSize!=0);
@@ -104,7 +104,7 @@ LargeCount ArrayOfReads::size(){
 }
 
 Read*ArrayOfReads::at(LargeIndex i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_maxSize!=0);
 	assert(m_numberOfChunks!=0);
 	assert(m_elements!=0);
@@ -114,7 +114,7 @@ Read*ArrayOfReads::at(LargeIndex i){
 
 	int chunkNumber=i/m_CHUNK_SIZE;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(chunkNumber>=m_numberOfChunks){
 		cout<<"ElementIdentifier="<<i<<" ChunkIdentifier="<<chunkNumber<<" NumberOfChunks="<<m_numberOfChunks<<" NumberOfElements="<<m_elements<<" MaxNumberOfElements="<<m_maxSize<<endl;
 	}
@@ -123,7 +123,7 @@ Read*ArrayOfReads::at(LargeIndex i){
 
 	int positionInSaidChunk=i%m_CHUNK_SIZE;
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(positionInSaidChunk<m_CHUNK_SIZE);
 	#endif
 
@@ -143,7 +143,7 @@ void ArrayOfReads::clear(){
 		m_maxSize=0;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_chunks==NULL);
 	assert(m_elements==0);
 	assert(m_numberOfChunks==0);
diff --git a/code/SequencesLoader/BzReader.cpp b/code/SequencesLoader/BzReader.cpp
index 66474f9..ba09dcb 100644
--- a/code/SequencesLoader/BzReader.cpp
+++ b/code/SequencesLoader/BzReader.cpp
@@ -62,7 +62,7 @@ char*BzReader::readLine(char*s, int n){
 
 	//cout<<"[BzReader::readLine]"<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(!(n<=__BzReader_MAXIMUM_LENGTH)){
 		cout<<"Expected: "<<__BzReader_MAXIMUM_LENGTH<<" Actual: "<<n<<endl;
 	}
diff --git a/code/SequencesLoader/FastqGzLoader.cpp b/code/SequencesLoader/FastqGzLoader.cpp
index 793b363..f5a7750 100644
--- a/code/SequencesLoader/FastqGzLoader.cpp
+++ b/code/SequencesLoader/FastqGzLoader.cpp
@@ -150,12 +150,12 @@ bool FastqGzLoader::pullLineWithReadaheadTechnology(char*buffer,int maximumLengt
 		m_currentStart=0;
 		m_firstNewLine=0;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_readaheadBuffer!=NULL);
 		#endif
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_readaheadBuffer!=NULL);
 	#endif
 
@@ -183,7 +183,7 @@ bool FastqGzLoader::pullLineWithReadaheadTechnology(char*buffer,int maximumLengt
 		if(m_debug)
 			cout<<"Reading data from disk"<<endl;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_bufferedBytes<=2*CONFIG_ZLIB_READAHEAD_SIZE);
 	
 		if(m_bufferedBytes>CONFIG_ZLIB_READAHEAD_SIZE){
@@ -204,7 +204,7 @@ bool FastqGzLoader::pullLineWithReadaheadTechnology(char*buffer,int maximumLengt
 		if(bytes==0)
 			m_noMoreBytes=true;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_bufferedBytes<=2*CONFIG_ZLIB_READAHEAD_SIZE);
 		#endif
 	}
@@ -223,12 +223,12 @@ bool FastqGzLoader::pullLineWithReadaheadTechnology(char*buffer,int maximumLengt
 	if(m_debug)
 		cout<<"seek offset if at m_firstNewLine "<<m_firstNewLine<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_firstNewLine<m_bufferedBytes);
 	assert(m_readaheadBuffer[m_firstNewLine]=='\n' || m_firstNewLine==m_bufferedBytes-1);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_bufferedBytes<=2*CONFIG_ZLIB_READAHEAD_SIZE);
 	#endif
 
@@ -260,7 +260,7 @@ bool FastqGzLoader::pullLineWithReadaheadTechnology(char*buffer,int maximumLengt
 
 	char*source=m_readaheadBuffer+m_currentStart;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(bytesToCopy==0){
 		cout<<"Error: nothing to copy, m_bufferedBytes= "<<m_bufferedBytes;
 		cout<<" m_firstNewLine "<<m_firstNewLine<<" m_currentStart "<<m_currentStart;
diff --git a/code/SequencesLoader/Loader.cpp b/code/SequencesLoader/Loader.cpp
index 2aff6e6..551a922 100644
--- a/code/SequencesLoader/Loader.cpp
+++ b/code/SequencesLoader/Loader.cpp
@@ -83,7 +83,7 @@ int Loader::load(string file,bool isGenome){
 }
 
 Read*Loader::at(LargeIndex i){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i<m_size);
 	#endif
 
@@ -91,7 +91,7 @@ Read*Loader::at(LargeIndex i){
 		loadSequences();
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(i>=m_currentOffset+m_reads.size()){
 		cout<<"i= "<<i<<" m_currentOffset= " << m_currentOffset<<" m_reads.size: " << m_reads.size()<<endl;
 	}
@@ -112,7 +112,7 @@ void Loader::clear(){
 	m_currentOffset=0;
 	//m_type=FORMAT_NULL;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_reads.size()==0);
 	#endif
 }
@@ -148,7 +148,7 @@ void Loader::reset(){
 
 	//m_type=FORMAT_NULL;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_reads.size()==0);
 	#endif
 }
diff --git a/code/SequencesLoader/Read.cpp b/code/SequencesLoader/Read.cpp
index 0bc76c6..d53c4d6 100644
--- a/code/SequencesLoader/Read.cpp
+++ b/code/SequencesLoader/Read.cpp
@@ -211,7 +211,7 @@ int Read::getRequiredBytes(){
 		requiredBits+=bitsToAdd;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(requiredBits%8==0);
 	#endif
 
diff --git a/code/SequencesLoader/SequenceFileDetector.cpp b/code/SequencesLoader/SequenceFileDetector.cpp
index 7172aa0..6efc506 100644
--- a/code/SequencesLoader/SequenceFileDetector.cpp
+++ b/code/SequencesLoader/SequenceFileDetector.cpp
@@ -131,10 +131,13 @@ void SequenceFileDetector::detectSequenceFiles(string & directory) {
 	 * Options for the matching algorithm
 	 */
 	bool enableSmartMatchingMode = true;
+
+#ifdef BRUTE_FORCE_MATCHING
 	bool enableBestHitMatchingMode = true;
 	int configurationMaximumHits = 1;
 	int configurationMinimumScore = 0;
 	int configurationMaximumScore = 2;
+#endif
 
 	// detect pairs
 	for(int i = 0 ; i < (int) files.size() ; ++i){
@@ -242,6 +245,10 @@ void SequenceFileDetector::detectSequenceFiles(string & directory) {
 			}
 		}
 
+		// try to do it by brute force !
+
+#ifdef BRUTE_FORCE_MATCHING // not very good
+
 		int bestMatch = -1;
 		int bestScore = 999;
 		int withBestMatch = 0;
@@ -349,6 +356,9 @@ void SequenceFileDetector::detectSequenceFiles(string & directory) {
 			consumedFiles.insert(bestMatch);
 		}
 
+#endif
+
+
 	}
 
 	// detect single files
diff --git a/code/SequencesLoader/SequencesLoader.cpp b/code/SequencesLoader/SequencesLoader.cpp
index 80299bb..e5af47f 100644
--- a/code/SequencesLoader/SequencesLoader.cpp
+++ b/code/SequencesLoader/SequencesLoader.cpp
@@ -55,7 +55,7 @@ void SequencesLoader::registerSequence(){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_distribution_sequence_id<m_loader.size());
 	#endif
 
@@ -73,13 +73,13 @@ void SequencesLoader::registerSequence(){
 		ReadHandle leftSequenceGlobalId=m_distribution_currentSequenceId;
 		LargeIndex leftSequenceIdOnRank=m_myReads->size()-1;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_loader.size()!=0);
 		#endif
 
 		ReadHandle rightSequenceGlobalId=leftSequenceGlobalId+m_loader.size();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(leftSequenceGlobalId<rightSequenceGlobalId);
 		assert(leftSequenceGlobalId>=0);
 		assert(leftSequenceGlobalId<m_totalNumberOfSequences);
@@ -89,7 +89,7 @@ void SequencesLoader::registerSequence(){
 
 		int rightSequenceRank=m_parameters->getRankFromGlobalId(rightSequenceGlobalId);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(rightSequenceRank>=m_size){
 			cout<<"m_distribution_currentSequenceId="<<m_distribution_currentSequenceId<<" m_distribution_sequence_id="<<m_distribution_sequence_id<<" LoaderSize="<<m_loader.size()<<" Rank="<<rightSequenceRank<<" Size="<<m_size<<endl;
 			assert(rightSequenceRank<m_size);
@@ -104,7 +104,7 @@ void SequencesLoader::registerSequence(){
 		(*m_myReads)[leftSequenceIdOnRank]->getPairedRead()->constructor(rightSequenceRank,rightSequenceIdOnRank,library);
 	}else if(m_LOADER_isRightFile){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_loader.size()!=0);
 		#endif
 
@@ -112,7 +112,7 @@ void SequencesLoader::registerSequence(){
 		LargeIndex rightSequenceIdOnRank=m_myReads->size()-1;
 		ReadHandle leftSequenceGlobalId=rightSequenceGlobalId-m_loader.size();
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(leftSequenceGlobalId>=0);
 
 		if(leftSequenceGlobalId>=m_totalNumberOfSequences){
@@ -131,7 +131,7 @@ void SequencesLoader::registerSequence(){
 		#endif
 
 		Rank leftSequenceRank=m_parameters->getRankFromGlobalId(leftSequenceGlobalId);
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		if(leftSequenceRank>=m_size){
 			cout<<"Global="<<leftSequenceGlobalId<<" rank="<<leftSequenceRank<<endl;
 		}
@@ -146,7 +146,7 @@ void SequencesLoader::registerSequence(){
 	}else if(m_isInterleavedFile && ((m_distribution_sequence_id)%2)==0){
 		ReadHandle rightSequenceGlobalId=(m_distribution_currentSequenceId)+1;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(rightSequenceGlobalId>=0);
 		assert(rightSequenceGlobalId<m_totalNumberOfSequences);
 		#endif
@@ -167,7 +167,7 @@ void SequencesLoader::registerSequence(){
 		LargeIndex rightSequenceIdOnRank=m_myReads->size()-1;
 		ReadHandle leftSequenceGlobalId=rightSequenceGlobalId-1;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(leftSequenceGlobalId>=0);
 		assert(leftSequenceGlobalId<m_totalNumberOfSequences);
 		assert(rightSequenceGlobalId>=0);
@@ -219,7 +219,7 @@ bool SequencesLoader::writeSequencesToAMOSFile(int rank,int size,
 				ReadHandle iid=m_distribution_currentSequenceId;
 				m_distribution_currentSequenceId++;
 				m_loader.at(i)->getSeq(seq,m_parameters->getColorSpaceMode(),true);
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(seq!=NULL);
 				#endif
 				strcpy(qlt,seq);
@@ -306,7 +306,7 @@ bool SequencesLoader::call_RAY_SLAVE_MODE_LOAD_SEQUENCES(){
 		m_distribution_file_id++){
 
 		/** should not load more sequences than required */
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_myReads->size()<=sequences);
 		#endif
 
@@ -340,7 +340,7 @@ bool SequencesLoader::call_RAY_SLAVE_MODE_LOAD_SEQUENCES(){
 			m_loader.at(m_distribution_sequence_id);
 
 			if(m_distribution_currentSequenceId>=startingSequenceId){
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_distribution_currentSequenceId>=startingSequenceId);
 				assert(m_distribution_currentSequenceId<=endingSequenceId);
 				#endif
@@ -404,7 +404,7 @@ void SequencesLoader::call_RAY_MPI_TAG_SET_FILE_ENTRIES(Message*message){
 
 	MessageUnit*incoming=(MessageUnit*)message->getBuffer();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(message->getCount()>=2);
 	assert(message->getCount()%2==0);
 	#endif
diff --git a/code/SpuriousSeedAnnihilator/AnnihilationWorker.cpp b/code/SpuriousSeedAnnihilator/AnnihilationWorker.cpp
index 88f2898..ec24965 100644
--- a/code/SpuriousSeedAnnihilator/AnnihilationWorker.cpp
+++ b/code/SpuriousSeedAnnihilator/AnnihilationWorker.cpp
@@ -104,7 +104,7 @@ bool AnnihilationWorker::searchGraphForNiceThings(int direction){
 
 	if(!m_searchIsStarted) {
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(direction == DIRECTION_PARENTS || direction == DIRECTION_CHILDREN);
 #endif
 
@@ -125,7 +125,7 @@ bool AnnihilationWorker::searchGraphForNiceThings(int direction){
 		else if(direction == DIRECTION_CHILDREN)
 			index = m_seed->size() -1;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(index == 0 || index == m_seed->size()-1);
 #endif
 		m_seed->at(index, &startingPoint);
@@ -186,7 +186,7 @@ bool AnnihilationWorker::searchGraphForNiceThings(int direction){
 			else if(direction == DIRECTION_CHILDREN)
 				links = m_attributeFetcher.getChildren();
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 			assert(links != NULL);
 #endif
 
diff --git a/code/SpuriousSeedAnnihilator/AttributeFetcher.cpp b/code/SpuriousSeedAnnihilator/AttributeFetcher.cpp
index 376a723..1399a7f 100644
--- a/code/SpuriousSeedAnnihilator/AttributeFetcher.cpp
+++ b/code/SpuriousSeedAnnihilator/AttributeFetcher.cpp
@@ -52,7 +52,7 @@ bool AttributeFetcher::fetchObjectMetaData(Kmer * object){
 		uint8_t edges = elements[bufferPosition++];
 
 		m_depth=elements[bufferPosition++];
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(m_depth>= 1);
 #endif
 
diff --git a/code/SpuriousSeedAnnihilator/GraphExplorer.cpp b/code/SpuriousSeedAnnihilator/GraphExplorer.cpp
index 5b7d6b3..166f8e4 100644
--- a/code/SpuriousSeedAnnihilator/GraphExplorer.cpp
+++ b/code/SpuriousSeedAnnihilator/GraphExplorer.cpp
@@ -340,7 +340,7 @@ bool GraphExplorer::work() {
 		return m_done;
 	}
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(!m_verticesToVisit.empty());
 	assert(!m_depths.empty());
 #endif
@@ -418,7 +418,7 @@ bool GraphExplorer::work() {
 		if(foundSomething && m_searchDepthForFirstResult < 0)
 			m_searchDepthForFirstResult = currentDepth;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(!m_depths.empty());
 #endif
 
@@ -434,7 +434,7 @@ bool GraphExplorer::work() {
 		else if(m_direction == EXPLORER_RIGHT)
 			links = m_attributeFetcher.getChildren();
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 		assert(links != NULL);
 #endif
 
diff --git a/code/SpuriousSeedAnnihilator/SeedFilteringWorkflow.cpp b/code/SpuriousSeedAnnihilator/SeedFilteringWorkflow.cpp
index 79ac028..f8a8ef4 100644
--- a/code/SpuriousSeedAnnihilator/SeedFilteringWorkflow.cpp
+++ b/code/SpuriousSeedAnnihilator/SeedFilteringWorkflow.cpp
@@ -38,7 +38,7 @@ void SeedFilteringWorkflow::initializeMethod(){
 	for(int i=0;i<(int)m_states.size(); i++)
 		m_states[i] = true;
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_states.size() == m_seeds->size());
 #endif
 
@@ -72,7 +72,7 @@ bool SeedFilteringWorkflow::hasUnassignedTask(){
 /** assign the next task to a worker and return this worker */
 Worker*SeedFilteringWorkflow::assignNextTask(){
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_seedIndex < (int)m_seeds->size());
 #endif
 
diff --git a/code/SpuriousSeedAnnihilator/SeedMergingWorkflow.cpp b/code/SpuriousSeedAnnihilator/SeedMergingWorkflow.cpp
index af1328b..05e475d 100644
--- a/code/SpuriousSeedAnnihilator/SeedMergingWorkflow.cpp
+++ b/code/SpuriousSeedAnnihilator/SeedMergingWorkflow.cpp
@@ -53,6 +53,8 @@ bool SeedMergingWorkflow::hasUnassignedTask(){
 	 */
 	bool enableSeedMerging = m_parameters->hasOption("-merge-seeds");
 
+	//enableSeedMerging = true;
+
 	if(!enableSeedMerging)
 		return false;
 
@@ -62,7 +64,7 @@ bool SeedMergingWorkflow::hasUnassignedTask(){
 /** assign the next task to a worker and return this worker */
 Worker*SeedMergingWorkflow::assignNextTask(){
 
-#ifdef ASSERT
+#ifdef CONFIG_ASSERT
 	assert(m_seedIndex < (int)m_seeds->size());
 #endif
 
diff --git a/code/SpuriousSeedAnnihilator/SpuriousSeedAnnihilator.cpp b/code/SpuriousSeedAnnihilator/SpuriousSeedAnnihilator.cpp
index 917e7db..e7d6c74 100644
--- a/code/SpuriousSeedAnnihilator/SpuriousSeedAnnihilator.cpp
+++ b/code/SpuriousSeedAnnihilator/SpuriousSeedAnnihilator.cpp
@@ -717,7 +717,7 @@ void SpuriousSeedAnnihilator::shareWithLinkedActors() {
 
 		char *messageBuffer = (char *)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
 
-#ifdef ASSERT_CONFIG
+#ifdef CONFIG_ASSERT_CONFIG
 		assert( messageBuffer != NULL );
 #endif /* ASSERT_CONFIG */
 
@@ -1563,14 +1563,14 @@ void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_REGISTER_SEEDS(){
 		return;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_activeQueries>=0);
 	#endif
 
 	if(m_activeQueries > 0)
 		return;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_activeQueries==0);
 	#endif
 
@@ -1715,7 +1715,7 @@ void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_CLEAN_SEEDS(){
 
 // Trace was here -> PASS
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_parameters != NULL);
 	assert(m_subgraph != NULL);
 	#endif
@@ -1724,7 +1724,7 @@ void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_CLEAN_SEEDS(){
 	GridTableIterator iterator;
 	iterator.constructor(m_subgraph, m_parameters->getWordSize(), m_parameters);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	LargeCount cleared=0;
 	#endif
 
@@ -1735,7 +1735,7 @@ void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_CLEAN_SEEDS(){
 		Kmer key=*(iterator.getKey());
 		m_subgraph->clearDirections(&key);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		cleared++;
 
 		Vertex*node=m_subgraph->find(&key);
@@ -1746,7 +1746,7 @@ void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_CLEAN_SEEDS(){
 
 // Trace was here -> PASS
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(cleared == m_subgraph->size());
 	#endif
 
@@ -1851,7 +1851,7 @@ bool SpuriousSeedAnnihilator::isPrimeNumber(int number) {
 }
 
 Rank SpuriousSeedAnnihilator::getArbiter() {
-	int rank = m_parameters->getSize();
+	int rank = m_parameters->getSize() - 1;
 
 	while(rank > 0 && !isPrimeNumber(rank))
 		rank--;
diff --git a/code/Surveyor/CoalescenceManager.cpp b/code/Surveyor/CoalescenceManager.cpp
index 7a069bf..d6aeaad 100644
--- a/code/Surveyor/CoalescenceManager.cpp
+++ b/code/Surveyor/CoalescenceManager.cpp
@@ -199,6 +199,16 @@ void CoalescenceManager::receive(Message & message) {
 		int producer = -1;
 		char * buffer = (char*) message.getBufferBytes();
 
+#ifdef CONFIG_ASSERT
+		if(!(buffer != NULL)) {
+			cout << "Count is " << message.getNumberOfBytes() << endl;
+			cout << "Tag ---------> " << message.getTag() << endl;
+		}
+		assert(message.getNumberOfBytes() > 0);
+		assert(buffer != NULL);
+		assert(sizeof(producer) > 0);
+#endif
+
 		memcpy(&producer, buffer, sizeof(producer));
 
 		int source = producer;
@@ -216,8 +226,10 @@ void CoalescenceManager::receive(Message & message) {
 			send(source, response);
 		}
 
-		//cout << "Resume reader 2" << endl;
-
+		/*
+		printName();
+		cout << " DEBUG Resume reader 2" << endl;
+*/
 	} else if(tag == FLUSH_BUFFERS) {
 
 		// DONE !!! -> flush buffers at the end.
@@ -331,6 +343,12 @@ bool CoalescenceManager::addKmerInBuffer(int producer, int & actor, int & sample
 	memcpy(buffer + offset, &sample, sizeof(sample));
 	offset += sizeof(sample);
 
+	/*
+	printName();
+	cout << "update DEBUG m_bufferSizes for actorIndex = " << actorIndex;
+	cout << " to " << offset << endl;
+	*/
+
 	m_bufferSizes[actorIndex] = offset;
 
 	// flush the message if no more bytes are available
@@ -391,16 +409,17 @@ void CoalescenceManager::flushBuffer(int sourceActor, int destinationActor) {
 
 	int bytes = offset;
 
-	/*
-	printName();
-	cout << "flushing data, sending stuff to " << actor << endl;
-	*/
-
 	Message routedMessage;
 	routedMessage.setTag(StoreKeeper::PUSH_SAMPLE_VERTEX);
 	routedMessage.setBuffer(buffer);
 	routedMessage.setNumberOfBytes(bytes);
 
+	/*
+	printName();
+	cout << "DEBUG flushing data, sending ";
+	cout << bytes << " bytes to " << actor << " tag= " << routedMessage.getTag() << endl;
+	*/
+
 	// free the buffer.
 	m_bufferSizes[actorIndex] = 0;
 
diff --git a/code/Surveyor/GenomeGraphReader.cpp b/code/Surveyor/GenomeGraphReader.cpp
index f9be0bd..f10409d 100644
--- a/code/Surveyor/GenomeGraphReader.cpp
+++ b/code/Surveyor/GenomeGraphReader.cpp
@@ -75,8 +75,17 @@ void GenomeGraphReader::startParty(Message & message) {
 	//m_aggregator = *(int*)(message.getBufferBytes());
 
 	m_reader.open(m_fileName.c_str());
+
+	m_bad = false;
+
+	if(!m_reader.isValid())
+		m_bad = true;
+
 	m_loaded = 0;
 
+	printName();
+	cout <<"opens file " << m_fileName << endl;
+
 	m_parent = message.getSourceActor();
 
 	/*
@@ -103,7 +112,7 @@ void GenomeGraphReader::readLine() {
 	char buffer[1024];
 	buffer[0] = '\0';
 
-	while(!m_reader.eof()) {
+	while(!m_bad && !m_reader.eof()) {
 		m_reader.getline(buffer, 1024);
 
 		// skip comment
@@ -113,13 +122,20 @@ void GenomeGraphReader::readLine() {
 		break;
 	}
 
-	if(m_reader.eof()) {
+	if(m_bad || m_reader.eof()) {
 
 		m_reader.close();
 
 		printName();
-		cout << " finished reading file " << m_fileName;
-		cout << " got " << m_loaded << " objects" << endl;
+
+		if(m_bad) {
+			cout << " Error: file " << m_fileName << " does not exist";
+			cout << endl;
+
+		} else {
+			cout << " finished reading file " << m_fileName;
+			cout << " got " << m_loaded << " objects" << endl;
+		}
 
 		Message finishedMessage;
 		finishedMessage.setTag(DONE);
@@ -147,6 +163,25 @@ void GenomeGraphReader::readLine() {
 		stringBuffer >> parents;
 		stringBuffer >> children;
 
+		///////////////////////////////////////////////////////////////////////
+		// convert the sequence to upper case
+
+		map<char,char> translationTable;
+		translationTable['a'] = 'A';
+		translationTable['t'] = 'T';
+		translationTable['g'] = 'G';
+		translationTable['c'] = 'C';
+
+		for(int i = 0 ; i < (int) sequence.length() ; ++i) {
+
+			char symbol = sequence[i];
+
+			if(translationTable.count(symbol) > 0) {
+				char correct = translationTable[symbol];
+
+				sequence [i] = correct;
+			}
+		}
 #if 0
 		cout << "DEBUG " << sequence << " with " << coverage << endl;
 #endif
@@ -206,6 +241,7 @@ void GenomeGraphReader::readLine() {
 
 		position += vertex.dump(messageBuffer + position);
 		memcpy(messageBuffer + position, &m_sample, sizeof(m_sample));
+
 		position += sizeof(m_sample);
 
 // maybe: accumulate many objects before flushing it.
@@ -229,7 +265,8 @@ void GenomeGraphReader::readLine() {
 		cout << endl;
 #endif
 
-		if(m_loaded % 1000000 == 0) {
+		int period = 1000000;
+		if(m_loaded % period == 0) {
 			printName();
 			cout << " loaded " << m_loaded << " sequences" << endl;
 
@@ -241,7 +278,11 @@ void GenomeGraphReader::readLine() {
 
 void GenomeGraphReader::setFileName(string & fileName, int sample) {
 
+	//int nameSpace = COLOR_NAMESPACE_SAMPLE;
+	//m_sample = (uint64_t)sample + nameSpace * COLOR_NAMESPACE_MULTIPLIER;
+
 	m_sample = sample;
+
 	m_fileName = fileName;
 
 #if 0
diff --git a/code/Surveyor/GenomeGraphReader.h b/code/Surveyor/GenomeGraphReader.h
index 93418c1..7f106a7 100644
--- a/code/Surveyor/GenomeGraphReader.h
+++ b/code/Surveyor/GenomeGraphReader.h
@@ -35,6 +35,9 @@ using namespace std;
 class GenomeGraphReader: public Actor {
 
 private:
+
+	bool m_bad;
+
 	int m_sample;
 	int m_loaded;
 
diff --git a/code/Surveyor/MatrixOwner.cpp b/code/Surveyor/MatrixOwner.cpp
index 83b384c..ffaae00 100644
--- a/code/Surveyor/MatrixOwner.cpp
+++ b/code/Surveyor/MatrixOwner.cpp
@@ -33,6 +33,9 @@ using namespace std;
 MatrixOwner::MatrixOwner() {
 
 	m_completedStoreActors = 0;
+
+	m_receivedPayloads = 0;
+
 }
 
 MatrixOwner::~MatrixOwner() {
@@ -90,6 +93,7 @@ void MatrixOwner::receive(Message & message) {
 		printName();
 		cout << "DEBUG add " << sample1 << " " << sample2 << " " << count << endl;
 */
+		m_receivedPayloads ++;
 
 		m_localGramMatrix[sample1][sample2] += count;
 
@@ -104,6 +108,9 @@ void MatrixOwner::receive(Message & message) {
 		if(m_completedStoreActors == getSize()) {
 
 
+			printName();
+			cout << "MatrixOwner received " << m_receivedPayloads << " payloads" << endl;
+
 			// create directory for Surveyor
 			ostringstream matrixFile;
 			matrixFile << m_parameters->getPrefix() << "/Surveyor/";
@@ -188,11 +195,49 @@ void MatrixOwner::computeDistanceMatrix() {
 	}
 }
 
+void MatrixOwner::printLocalGramMatrix(ostream & stream, map<SampleIdentifier, map<SampleIdentifier, LargeCount> > & matrix) {
+
+	int numberOfSamples = m_sampleNames->size();
+
+	for(int i = 0 ; i < numberOfSamples ; ++i) {
+
+		string & sampleName1 = m_sampleNames->at(i);
+
+		stream << "	" << sampleName1;
+	}
+
+	stream << endl;
+
+
+	for(int i = 0 ; i < numberOfSamples ; ++i) {
+
+		string & sampleName1 = m_sampleNames->at(i);
+
+		stream << sampleName1;
+
+		for(int j = 0 ; j < numberOfSamples ; ++j) {
+
+			//string & sampleName2 = m_sampleNames->at(j);
+
+			LargeCount hits = 0;
+
+			if(matrix.count(i) > 0 && matrix[i].count(j) > 0) {
+
+				hits = matrix[i][j];
+			}
+
+			stream << "	" << hits;
+		}
+
+		stream << endl;
+	}
+}
+
 /**
  * Write it in RaySurveyorResults/SurveyorMatrix.tsv
  * Also write a distance matrix too !
  */
-void MatrixOwner::printLocalGramMatrix(ostream & stream, map<SampleIdentifier, map<SampleIdentifier, LargeCount> > & matrix) {
+void MatrixOwner::printLocalGramMatrixWithHash(ostream & stream, map<SampleIdentifier, map<SampleIdentifier, LargeCount> > & matrix) {
 
 	/*
 	printName();
diff --git a/code/Surveyor/MatrixOwner.h b/code/Surveyor/MatrixOwner.h
index a6d691c..ceb17e2 100644
--- a/code/Surveyor/MatrixOwner.h
+++ b/code/Surveyor/MatrixOwner.h
@@ -33,6 +33,8 @@ using namespace std;
 class MatrixOwner : public Actor {
 private:
 
+	int m_receivedPayloads;
+
 	Parameters * m_parameters;
 	vector<string> * m_sampleNames;
 
@@ -41,7 +43,9 @@ private:
 
 	int m_mother;
 	int m_completedStoreActors;
+
 	void printLocalGramMatrix(ostream & stream, map<SampleIdentifier, map<SampleIdentifier, LargeCount> > & matrix);
+	void printLocalGramMatrixWithHash(ostream & stream, map<SampleIdentifier, map<SampleIdentifier, LargeCount> > & matrix);
 
 	void computeDistanceMatrix();
 
diff --git a/code/Surveyor/Mother.cpp b/code/Surveyor/Mother.cpp
index f15e161..b7f27ed 100644
--- a/code/Surveyor/Mother.cpp
+++ b/code/Surveyor/Mother.cpp
@@ -48,6 +48,8 @@ Mother::Mother() {
 
 	m_finishedMothers = 0;
 	//cout << "DEBUG Mother constructor" << endl;
+
+	m_flushedMothers = 0;
 }
 
 Mother::~Mother() {
@@ -120,6 +122,10 @@ void Mother::receive(Message & message) {
 
 	} else if(tag == StoreKeeper::MERGE_OK) {
 
+		// TODO: the bug https://github.com/sebhtml/ray/issues/216
+		// is caused by the fact that this message is not
+		// received .
+
 		/*
 		Message newMessage;
 		newMessage.setTag(MERGE_OK);
@@ -136,10 +142,22 @@ void Mother::receive(Message & message) {
 			// all readers have finished,
 			// now tell mother to flush aggregators
 
-			sendToFirstMother(FLUSH_AGGREGATOR, FLUSH_AGGREGATOR_OK);
+			/*
+			printName();
+			cout << "DEBUG  m_finishedMothers: " << m_finishedMothers << " ";
+			cout << " starting pair FLUSH_AGGREGATOR, FLUSH_AGGREGATOR_RETURN";
+			cout << endl;
+			*/
+
+			sendToFirstMother(FLUSH_AGGREGATOR, FLUSH_AGGREGATOR_RETURN);
 		}
 	} else if(tag == FLUSH_AGGREGATOR) {
 
+		/*
+		printName();
+		cout << "DEBUG received FLUSH_AGGREGATOR" << endl;
+		*/
+
 		m_bigMother = source;
 
 		// forward the message to the aggregator
@@ -148,66 +166,99 @@ void Mother::receive(Message & message) {
 		newMessage.setTag(CoalescenceManager::FLUSH_BUFFERS);
 		send(m_coalescenceManager, newMessage);
 
+		Message newMessage2;
+		newMessage2.setTag(FLUSH_AGGREGATOR_RETURN);
+		send(source, newMessage2);
+
 	} else if(tag == CoalescenceManager::FLUSH_BUFFERS_OK) {
 
+		/*
+		printName();
+		cout << "DEBUG CoalescenceManager sent FLUSH_BUFFERS_OK to mother." << endl;
+		*/
+
 		Message response;
 		response.setTag(FLUSH_AGGREGATOR_OK);
 		send(m_bigMother, response);
 
-	} else if(tag == m_responseTag) {
+		/*
+		printName();
+		cout << "DEBUG sending FLUSH_AGGREGATOR_OK to m_bigMother" << endl;
+		*/
 
-		// every mother was informed.
-		if(m_motherToKill < getSize()) {
+	} else if(tag == MatrixOwner::MATRIX_IS_READY) {
+
+		sendToFirstMother(SHUTDOWN, SHUTDOWN_OK);
+
+	} else if(tag == FLUSH_AGGREGATOR_OK) {
 
-			if(m_responseTag == SHUTDOWN_OK) {
-				return;
+		/*
+		printName();
+		cout << "DEBUG received FLUSH_AGGREGATOR_OK" << endl;
+		*/
 
-			} else if(m_responseTag == FLUSH_AGGREGATOR_OK) {
+		m_flushedMothers++;
 
-				// spawn the MatrixOwner here !
+		if(m_flushedMothers < getSize())
+			return;
 
-				MatrixOwner * matrixOwner = new MatrixOwner();
-				spawn(matrixOwner);
+		// spawn the MatrixOwner here !
 
-				m_matrixOwner = matrixOwner->getName();
+		MatrixOwner * matrixOwner = new MatrixOwner();
+		spawn(matrixOwner);
+
+		m_matrixOwner = matrixOwner->getName();
+
+		printName();
+		cout << "Spawned MatrixOwner actor !" << endl;
 
-				printName();
-				cout << "Spawned MatrixOwner actor !" << endl;
+		// tell the StoreKeeper actors to send their stuff to the
+		// MatrixOwner actor
+		// The Mother of Mother will wait for a signal from MatrixOwner
 
-				// tell the StoreKeeper actors to send their stuff to the
-				// MatrixOwner actor
-				// The Mother of Mother will wait for a signal from MatrixOwner
+		Message greetingMessage;
 
-				Message greetingMessage;
+		vector<string> * names = & m_sampleNames;
 
-				vector<string> * names = & m_sampleNames;
+		char buffer[32];
+		int offset = 0;
+		memcpy(buffer + offset, &m_parameters, sizeof(m_parameters));
+		offset += sizeof(m_parameters);
+		memcpy(buffer + offset, &names, sizeof(names));
+		offset += sizeof(names);
 
-				char buffer[32];
-				int offset = 0;
-				memcpy(buffer + offset, &m_parameters, sizeof(m_parameters));
-				offset += sizeof(m_parameters);
-				memcpy(buffer + offset, &names, sizeof(names));
-				offset += sizeof(names);
+		greetingMessage.setBuffer(&buffer);
+		greetingMessage.setNumberOfBytes(offset);
+
+		greetingMessage.setTag(MatrixOwner::GREETINGS);
+		send(m_matrixOwner, greetingMessage);
+
+		sendToFirstMother(MERGE, MERGE_OK);
+
+
+	} else if(tag == m_responseTag) {
 
-				greetingMessage.setBuffer(&buffer);
-				greetingMessage.setNumberOfBytes(offset);
 
-				greetingMessage.setTag(MatrixOwner::GREETINGS);
-				send(m_matrixOwner, greetingMessage);
+		if(m_responseTag == SHUTDOWN_OK) {
 
-				sendToFirstMother(MERGE, MERGE_OK);
+		} else if(m_responseTag == MERGE_OK) {
 
-			} else if(m_responseTag == MERGE_OK) {
+		} else if(m_responseTag == FLUSH_AGGREGATOR_RETURN) {
 
-			}
+			/*
+			printName();
+			cout << "DEBUG FLUSH_AGGREGATOR_RETURN received ";
+			cout << "m_motherToKill " << m_motherToKill << endl;
+			*/
 		}
 
-		sendMessageWithReply(m_motherToKill, m_forwardTag);
-		m_motherToKill--;
+		// every mother was informed.
+		if(m_motherToKill >= getSize()) {
 
-	} else if(tag == MatrixOwner::MATRIX_IS_READY) {
+			sendMessageWithReply(m_motherToKill, m_forwardTag);
+			m_motherToKill--;
+		}
 
-		sendToFirstMother(SHUTDOWN, SHUTDOWN_OK);
 	}
 }
 
@@ -218,7 +269,7 @@ void Mother::sendToFirstMother(int forwardTag, int responseTag) {
 
 	m_motherToKill = 2 * getSize() - 1;
 
-	sendMessageWithReply(m_motherToKill, forwardTag);
+	sendMessageWithReply(m_motherToKill, m_forwardTag);
 	m_motherToKill--;
 }
 
@@ -234,6 +285,13 @@ void Mother::sendMessageWithReply(int & actor, int tag) {
 	if(tag == MERGE) {
 		message.setBuffer(&m_matrixOwner);
 		message.setNumberOfBytes(sizeof(m_matrixOwner));
+
+	} else if(tag == FLUSH_AGGREGATOR) {
+
+		/*
+		printName();
+		cout << " DEBUG sending message FLUSH_AGGREGATOR" << endl;
+		*/
 	}
 
 	send(actor, message);
diff --git a/code/Surveyor/Mother.h b/code/Surveyor/Mother.h
index d45055f..c420d23 100644
--- a/code/Surveyor/Mother.h
+++ b/code/Surveyor/Mother.h
@@ -56,6 +56,7 @@ private:
 
 	int m_matrixOwner;
 
+	int m_flushedMothers;
 	int m_finishedMothers;
 
 	Parameters * m_parameters;
@@ -106,9 +107,10 @@ public:
 		SHUTDOWN_OK,
 		FLUSH_AGGREGATOR,
 		FLUSH_AGGREGATOR_OK,
-		LAST_TAG,
+		FLUSH_AGGREGATOR_RETURN,
 		MERGE,
-		MERGE_OK
+		MERGE_OK,
+		LAST_TAG,
 	};
 
 	void setParameters(Parameters * parameters);
diff --git a/code/Surveyor/StoreKeeper.cpp b/code/Surveyor/StoreKeeper.cpp
index 5c14984..84eef34 100644
--- a/code/Surveyor/StoreKeeper.cpp
+++ b/code/Surveyor/StoreKeeper.cpp
@@ -34,14 +34,19 @@ using namespace std;
 
 StoreKeeper::StoreKeeper() {
 
+	m_storeDataCalls = 0;
+
 	m_receivedObjects = 0;
 
 	m_configured = false;
 	m_kmerLength = 0;
+
+	m_receivedPushes = 0;
 }
 
 StoreKeeper::~StoreKeeper() {
 
+	m_receivedPushes = 0;
 }
 
 void StoreKeeper::receive(Message & message) {
@@ -54,12 +59,17 @@ void StoreKeeper::receive(Message & message) {
 		configureHashTable();
 
 	if(tag == PUSH_SAMPLE_VERTEX) {
+
+		m_receivedPushes ++;
+
 		pushSampleVertex(message);
 
 	} else if( tag == CoalescenceManager::DIE) {
 
 		printName();
-		cout << "(StoreKeeper) received " << m_receivedObjects << " objects in total" << endl;
+		cout << "(StoreKeeper) received " << m_receivedObjects << " objects in total";
+		cout << " with " << m_receivedPushes << " push operations" << endl;
+
 
 		// * 2 because we store pairs
 		uint64_t size = m_hashTable.size() * 2;
@@ -75,6 +85,11 @@ void StoreKeeper::receive(Message & message) {
 
 	} else if(tag == MERGE) {
 
+
+		printName();
+		cout << "DEBUG at MERGE message reception ";
+		cout << "(StoreKeeper) received " << m_receivedObjects << " objects in total";
+		cout << " with " << m_receivedPushes << " push operations" << endl;
 		computeLocalGramMatrix();
 
 		m_mother = source;
@@ -235,12 +250,21 @@ void StoreKeeper::computeLocalGramMatrix() {
 
 	// printColorReport();
 
-
+	uint64_t sum = 0;
 
 	// compute the local Gram matrix
 
 	int colors = m_colorSet.getTotalNumberOfVirtualColors();
 
+#if 0
+	cout << "DEBUG " << colors << " virtual colors" << endl;
+	cout << "DEBUG312 m_storeDataCalls " << m_storeDataCalls << endl;
+#endif
+
+#ifdef CONFIG_ASSERT
+	int withZeroReferences = 0;
+#endif
+
 	for(int i = 0 ; i < colors ; ++i) {
 
 		VirtualKmerColorHandle virtualColor = i;
@@ -249,11 +273,55 @@ void StoreKeeper::computeLocalGramMatrix() {
 
 		LargeCount hits = m_colorSet.getNumberOfReferences(virtualColor);
 
+#ifdef CONFIG_ASSERT
+		if(hits == 0) {
+			withZeroReferences ++;
+		}
+#endif
+
+		// TODO for "Directed Surveys",
+		// add a check for colors in the virtualColor that are not in a namespace.
+		// This directed survey only aims at counting colored kmers with colors
+		// other than sample colors
+
+		bool useFirstColorToFilter = false;
+
+		int filterColor = 0;
+		bool hasFilter = samples->count(filterColor) > 0;
+
 		// since people are going to use this to check
 		// for genome size, don't duplicate counts
 		//
 		bool reportTwoDNAStrands = false;
 
+#if 0
+		cout << "DEBUG ***********";
+		cout << "virtualColor: " << i << " ";
+		cout << " samples: " << samples->size() << endl;
+		cout << "  Sample list:";
+#endif
+
+#if 0
+		for(set<PhysicalKmerColor>:: iterator sampleIterator = samples->begin();
+				sampleIterator != samples->end() ;
+				++sampleIterator) {
+
+			PhysicalKmerColor value = *sampleIterator;
+
+			cout << " " << value;
+		}
+		cout << endl;
+
+		cout << " References: " << hits << " hash table entries ";
+
+#ifdef CONFIG_ASSERT
+		cout << " DEBUG.WithZeroReferences ---> " << withZeroReferences << endl;
+#endif
+
+		cout << endl;
+
+#endif
+
 		// we have 2 DNA strands !!!
 		if(reportTwoDNAStrands)
 			hits *= 2;
@@ -266,22 +334,44 @@ void StoreKeeper::computeLocalGramMatrix() {
 				sample1 != samples->end();
 				++sample1) {
 
+			SampleIdentifier sample1Index = *sample1;
+
 			for(set<PhysicalKmerColor>::iterator sample2 = samples->begin();
 				sample2 != samples->end();
 				++sample2) {
 
-				SampleIdentifier sample1Index = *sample1;
 				SampleIdentifier sample2Index = *sample2;
 
 				//if(sample2 < sample1)
 				// this is a diagonal matrix
 
+				if(useFirstColorToFilter && !hasFilter) {
+					continue;
+				}
+
 				m_localGramMatrix[sample1Index][sample2Index] += hits;
+
+				/*
+				cout << "DEBUG count entry ";
+				cout << "[ " << sample1Index << " ";
+				cout << sample2Index << " ";
+				cout <<
+				*/
+
+				sum += hits;
 				//m_localGramMatrix[sample2Index][sample1Index] += hits;
 			}
 		}
 	}
 
+#if 0
+	printName();
+	cout << "DEBUG checksum " << sum << endl;
+
+	uint64_t size = m_hashTable.size();
+	cout << "DEBUG m_hashTable.size() " << size << endl;
+#endif
+
 	//printLocalGramMatrix();
 }
 
@@ -340,7 +430,6 @@ void StoreKeeper::pushSampleVertex(Message & message) {
 	while(position < bytes) {
 		Vertex vertex;
 
-
 		position += vertex.load(buffer + position);
 
 		int sample = -1;
@@ -375,6 +464,10 @@ void StoreKeeper::pushSampleVertex(Message & message) {
 	response.setBuffer(&producer);
 	response.setNumberOfBytes(sizeof(producer));
 
+#ifdef CONFIG_ASSERT
+	assert(sizeof(producer) > 0);
+#endif
+
 	send(source, response);
 }
 
@@ -386,17 +479,21 @@ void StoreKeeper::printStatus() {
 
 void StoreKeeper::storeData(Vertex & vertex, int & sample) {
 
+	m_storeDataCalls++;
+
 	Kmer kmer = vertex.getKey();
 	Kmer lowerKey;
 	kmer.getLowerKey(&lowerKey, m_kmerLength, m_colorSpaceMode);
 
-	uint64_t before = m_hashTable.size() * 2;
+	uint64_t before = m_hashTable.size();
 
 	ExperimentVertex * graphVertex = m_hashTable.insert(&lowerKey);
 
 	// * 2 because we store pairs
-	uint64_t size = m_hashTable.size() * 2;
+	uint64_t size = m_hashTable.size();
 
+	// check if we inserted something.
+	// if it is the case, then assign the dummy color to it.
 	if(before < size) {
 
 		set<PhysicalKmerColor> emptySet;
@@ -405,6 +502,10 @@ void StoreKeeper::storeData(Vertex & vertex, int & sample) {
 		m_colorSet.incrementReferences(noColor);
 
 		graphVertex->setVirtualColor(noColor);
+
+#ifdef CONFIG_ASSERT
+		assert(noColor == NULL_VIRTUAL_COLOR);
+#endif
 	}
 
 	int period = 1000000;
@@ -432,12 +533,76 @@ void StoreKeeper::storeData(Vertex & vertex, int & sample) {
 		return;
 	}
 
+#ifdef CONFIG_ASSERT
+
+	set<PhysicalKmerColor> * theOldSamples = m_colorSet.getPhysicalColors(oldVirtualColor);
+	set<PhysicalKmerColor> oldSamples = *theOldSamples;
+
+	assert(oldSamples.count(sampleColor) == 0);
+#endif
+
 	VirtualKmerColorHandle newVirtualColor= m_colorSet.getVirtualColorFrom(oldVirtualColor, sampleColor);
 
+#ifdef CONFIG_ASSERT
+	assert(m_colorSet.virtualColorHasPhysicalColor(newVirtualColor, sampleColor));
+	set<PhysicalKmerColor>* samples = m_colorSet.getPhysicalColors(newVirtualColor);
+
+
+	assert(samples->count(sampleColor) > 0);
+#endif
+
+
+#ifdef CONFIG_ASSERT2
+	if(oldVirtualColor == newVirtualColor) {
+
+		cout << "new sampleColor " << sampleColor << endl;
+		//cout << "References " << m_colorSet.getNumberOfReferences(newVirtualColor);
+		cout << endl;
+
+		cout << " >>> Old samples " << oldSamples.size () << endl;
+
+		for(set<PhysicalKmerColor>::iterator i = oldSamples.begin();
+				i != oldSamples.end() ; ++i) {
+
+			cout << " " << *i;
+
+		}
+
+		cout << endl;
+
+		cout << " old color " << oldVirtualColor;
+		cout << " refs " << m_colorSet.getNumberOfReferences(oldVirtualColor) << endl;
+
+
+		set<PhysicalKmerColor>* samples = m_colorSet.getPhysicalColors(newVirtualColor);
+
+		cout << " >>> new samples " << samples->size () << endl;
+
+		for(set<PhysicalKmerColor>::iterator i = samples->begin();
+				i != samples->end() ; ++i) {
+
+			cout << " " << *i;
+
+		}
+
+		cout << endl;
+
+		cout << " new color " << newVirtualColor;
+		cout << " refs " << m_colorSet.getNumberOfReferences(newVirtualColor) << endl;
+
+
+	}
+
+	// we can reuse the same handle if it has 0 references
+	// The call to decrementReferences is done above the
+	// call to getVirtualColorFrom
+	//assert(oldVirtualColor != newVirtualColor);
+#endif
+
 	graphVertex->setVirtualColor(newVirtualColor);
 
-	m_colorSet.decrementReferences(oldVirtualColor);
 	m_colorSet.incrementReferences(newVirtualColor);
+	m_colorSet.decrementReferences(oldVirtualColor);
 
 	/*
 	LargeCount referencesForOld = m_colorSet.getNumberOfReferences(oldVirtualColor);
diff --git a/code/Surveyor/StoreKeeper.h b/code/Surveyor/StoreKeeper.h
index c3aed94..e44cf98 100644
--- a/code/Surveyor/StoreKeeper.h
+++ b/code/Surveyor/StoreKeeper.h
@@ -44,6 +44,8 @@ class StoreKeeper: public Actor {
 
 private:
 
+	int m_storeDataCalls;
+	int m_receivedPushes;
 	map<SampleIdentifier, map<SampleIdentifier, LargeCount> > m_localGramMatrix;
 
 	map<SampleIdentifier, map<SampleIdentifier, LargeCount> >::iterator m_iterator1;
diff --git a/code/TaxonomyViewer/TaxonomyViewer.cpp b/code/TaxonomyViewer/TaxonomyViewer.cpp
index e5fd1c3..4ea637e 100644
--- a/code/TaxonomyViewer/TaxonomyViewer.cpp
+++ b/code/TaxonomyViewer/TaxonomyViewer.cpp
@@ -62,7 +62,7 @@ void TaxonomyViewer::call_RAY_MASTER_MODE_PHYLOGENY_MAIN(){
 		
 		m_ranksThatLoadedTaxons++;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_rank==0);
 		#endif
 
@@ -115,7 +115,7 @@ void TaxonomyViewer::call_RAY_MASTER_MODE_PHYLOGENY_MAIN(){
 		ofstream f;
 		f.open(file.c_str(),ios_base::app);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(f.is_open());
 		#endif
 
@@ -145,7 +145,7 @@ void TaxonomyViewer::copyTaxonsFromSecondaryTable(){
 
 	cout<<"[TaxonomyViewer::copyTaxonsFromSecondaryTable] "<<before<<" -> "<<after<<endl;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_taxonsForPhylogeny.size() == m_taxonsForPhylogenyMaster.size());
 	#endif
 
@@ -219,7 +219,7 @@ void TaxonomyViewer::sendTreeCounts(){
 
 	}else if(!m_messageSent){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_countIterator!= m_taxonObservations.end());
 		#endif
 
@@ -245,7 +245,7 @@ void TaxonomyViewer::sendTreeCounts(){
 			m_countIterator++;
 		}
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bufferPosition!=0);
 		#endif
 
@@ -268,7 +268,7 @@ void TaxonomyViewer::call_RAY_MPI_TAG_TAXON_OBSERVATIONS(Message*message){
 
 	int count=message->getCount();
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(count%2==0);
 	assert(m_rank==MASTER_RANK);
 	#endif
@@ -327,6 +327,8 @@ void TaxonomyViewer::loadTree(){
 
 		int oldSize=m_taxonsForPhylogeny.size();
 
+		set<TaxonIdentifier> taxonsWithWarning;
+
 		while(loader.hasNext()){
 
 			TaxonIdentifier parent;
@@ -334,8 +336,11 @@ void TaxonomyViewer::loadTree(){
 	
 			loader.getNext(&parent,&child);
 
-			if(parent==child){
-				cout<<"Error: parent and child are the same: "<<parent<<" and "<<child<<endl;
+			if(parent==child && taxonsWithWarning.count(parent) == 0){
+
+				cout<<"Warning: parent and child are the same: "<<parent<<" and "<<child<<endl;
+
+				taxonsWithWarning.insert(parent);
 			}
 
 			if((m_loadAllTree || (m_taxonsForPhylogeny.count(child) > 0)) && parent!=child){
@@ -385,7 +390,7 @@ void TaxonomyViewer::gatherKmerObservations(){
 
 	while(iterator.hasNext()){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parity==0 || parity==1);
 		#endif
 
@@ -422,7 +427,7 @@ void TaxonomyViewer::gatherKmerObservations(){
 			continue; // the k-mer is not nicely assembled...
 		}
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(nicelyAssembled || !useOnlyAssembledKmer);
 		#endif
 
@@ -443,10 +448,11 @@ void TaxonomyViewer::gatherKmerObservations(){
 	
 			PhysicalKmerColor nameSpace=physicalColor/COLOR_NAMESPACE_MULTIPLIER;
 		
+			// associated with -with-taxonomy
 			if(nameSpace==COLOR_NAMESPACE_PHYLOGENY){
 				PhysicalKmerColor colorForPhylogeny=physicalColor % COLOR_NAMESPACE_MULTIPLIER;
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				if(m_colorsForPhylogeny.count(colorForPhylogeny)==0){
 					//cout<<"Error: color "<<colorForPhylogeny<<" should be in m_colorsForPhylogeny which contains "<<m_colorsForPhylogeny.size()<<endl;
 				}
@@ -473,7 +479,7 @@ void TaxonomyViewer::gatherKmerObservations(){
 					continue;
 				}
 
-				#ifdef ASSERT
+				#ifdef CONFIG_ASSERT
 				assert(m_genomeToTaxon.count(colorForPhylogeny)>0);
 				#endif
 
@@ -579,7 +585,7 @@ void TaxonomyViewer::showObservations_XML(ostream*stream){
 	for(map<string,LargeCount>::iterator i=rankSelfObservations.begin();i!=rankSelfObservations.end();i++){
 		string rank=i->first;
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(rankRecursiveObservations.count(rank)>0);
 		assert(rankSelfObservations.count(rank)>0);
 		#endif
@@ -620,14 +626,14 @@ void TaxonomyViewer::showObservations_XML(ostream*stream){
 
 		string rank=getTaxonRank(taxon);
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(rankSelfObservations.count(rank)>0);
 		assert(rankRecursiveObservations.count(rank)>0);
 		#endif
 
 		LargeCount rankRecursiveCount=rankRecursiveObservations[rank];
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		LargeCount rankSelfCount=rankSelfObservations[rank]; //-
 
 		assert(rankSelfCount>=0);
@@ -835,7 +841,7 @@ void TaxonomyViewer::classifySignal(vector<TaxonIdentifier>*taxons,int kmerCover
 
 	}else{ // more than 1
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(taxons->size()>1);
 		#endif
 
@@ -863,7 +869,7 @@ void TaxonomyViewer::classifySignal(vector<TaxonIdentifier>*taxons,int kmerCover
 
 		if(parentCount.size()==1){ // only 1 common ancestor, easy
 			
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			if(!(parentCount.begin()->second == found)){
 				cout<<"Error: taxons: "<<taxons->size()<<", parentCount: "<<parentCount.size()<<" 1 element with "<<parentCount.begin()->second<<" taxons"<<endl;
 			}
@@ -888,7 +894,7 @@ void TaxonomyViewer::classifySignal(vector<TaxonIdentifier>*taxons,int kmerCover
 		// since we have a tree, find the nearest common ancestor
 		// in the worst case, the common ancestor is the root
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parentCount.size()>1);
 		#endif
 
@@ -1160,7 +1166,7 @@ void TaxonomyViewer::sendTaxonsFromMaster(){
 
 	}else if(!m_messageSent){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_taxonIterator!= m_taxonsForPhylogeny.end());
 		#endif
 
@@ -1177,7 +1183,7 @@ void TaxonomyViewer::sendTaxonsFromMaster(){
 			m_taxonIterator++;
 		}
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bufferPosition!=0);
 		#endif
 
@@ -1209,7 +1215,7 @@ void TaxonomyViewer::sendTaxonsToMaster(){
 
 	}else if(!m_messageSent){
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_taxonIterator!= m_taxonsForPhylogeny.end());
 		#endif
 
@@ -1226,7 +1232,7 @@ void TaxonomyViewer::sendTaxonsToMaster(){
 			m_taxonIterator++;
 		}
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(bufferPosition!=0);
 		#endif
 
@@ -1260,7 +1266,7 @@ void TaxonomyViewer::extractColorsForPhylogeny(){
 		Vertex*node=iterator.next();
 		Kmer key=*(iterator.getKey());
 
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(parity==0 || parity==1);
 		#endif
 
diff --git a/code/VerticesExtractor/GridTable.cpp b/code/VerticesExtractor/GridTable.cpp
index 29f0017..3c16a14 100644
--- a/code/VerticesExtractor/GridTable.cpp
+++ b/code/VerticesExtractor/GridTable.cpp
@@ -33,7 +33,7 @@
 
 void GridTable::constructor(int rank,Parameters*parameters){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(parameters!=NULL);
 	#endif
 
@@ -82,7 +82,7 @@ LargeCount GridTable::size(){
 }
 
 Vertex*GridTable::find(Kmer*key){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(key!=NULL);
 	#endif
 
@@ -109,11 +109,11 @@ Vertex*GridTable::find(Kmer*key){
 }
 
 Vertex*GridTable::insert(Kmer*key){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(key!=NULL);
 	#endif
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_parameters!=NULL);
 	#endif
 
@@ -138,13 +138,13 @@ bool GridTable::inserted(){
 }
 
 bool GridTable::isAssembledByGreaterRank(Kmer*a,Rank origin){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 
 	Vertex*entry=find(a);
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(entry!=NULL);
 	#endif
 
@@ -152,13 +152,13 @@ bool GridTable::isAssembledByGreaterRank(Kmer*a,Rank origin){
 }
 
 bool GridTable::isAssembled(Kmer*a){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 
 	Vertex*entry=find(a);
 	
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(entry!=NULL);
 	#endif
 
@@ -167,7 +167,7 @@ bool GridTable::isAssembled(Kmer*a){
 
 void GridTable::addRead(Kmer*a,ReadAnnotation*e){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	assert(e!=NULL);
 	#endif
@@ -175,7 +175,7 @@ void GridTable::addRead(Kmer*a,ReadAnnotation*e){
 	Vertex*i=find(a);
 	i->addRead(a,e);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	ReadAnnotation*reads=i->getReads(a);
 	assert(reads!=NULL);
 	#endif
@@ -183,7 +183,7 @@ void GridTable::addRead(Kmer*a,ReadAnnotation*e){
 
 ReadAnnotation*GridTable::getReads(Kmer*a){
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 
@@ -197,7 +197,7 @@ ReadAnnotation*GridTable::getReads(Kmer*a){
 }
 
 void GridTable::addDirection(Kmer*a,Direction*d){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	assert(d!=NULL);
 
@@ -210,7 +210,7 @@ void GridTable::addDirection(Kmer*a,Direction*d){
 
 	Vertex*i=find(a);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i!=NULL);
 	#endif
 
@@ -218,7 +218,7 @@ void GridTable::addDirection(Kmer*a,Direction*d){
 }
 
 vector<Direction> GridTable::getDirections(Kmer*a){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 
@@ -229,7 +229,7 @@ vector<Direction> GridTable::getDirections(Kmer*a){
 		return p;
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i!=NULL);
 
 	/* do a copy to track to check for a segmentation fault */
@@ -241,13 +241,13 @@ vector<Direction> GridTable::getDirections(Kmer*a){
 }
 
 void GridTable::clearDirections(Kmer*a){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(a!=NULL);
 	#endif
 
 	Vertex*i=find(a);
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(i!=NULL);
 	#endif
 	
diff --git a/code/VerticesExtractor/GridTableIterator.cpp b/code/VerticesExtractor/GridTableIterator.cpp
index 25e6df3..fad753a 100644
--- a/code/VerticesExtractor/GridTableIterator.cpp
+++ b/code/VerticesExtractor/GridTableIterator.cpp
@@ -44,7 +44,7 @@ Vertex*GridTableIterator::next(){
 		m_currentKey=m_currentKey.complementVertex(m_parameters->getWordSize(),m_parameters->getColorSpaceMode());
 		return m_currentEntry;
 	}
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(hasNext());
 	#endif
 	m_currentEntry=m_iterator.next();
diff --git a/code/VerticesExtractor/Vertex.cpp b/code/VerticesExtractor/Vertex.cpp
index 291262d..f253fe4 100644
--- a/code/VerticesExtractor/Vertex.cpp
+++ b/code/VerticesExtractor/Vertex.cpp
@@ -59,7 +59,7 @@ void Vertex::assemble(Rank origin){
 	if(origin>m_assembled)
 		m_assembled=origin;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_assembled!=__NO_ORIGIN);
 	#endif
 }
@@ -178,7 +178,7 @@ void Vertex::addRead(Kmer*vertex,ReadAnnotation*e){
 }
 
 void Vertex::addDirection(Kmer*vertex,Direction*e){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	Vertex copy0=*this;
 
 	if(m_directions != NULL){
@@ -195,7 +195,7 @@ void Vertex::addDirection(Kmer*vertex,Direction*e){
 	e->setNext(m_directions);
 	m_directions=e;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_directions != NULL);
 	#endif
 }
@@ -224,7 +224,7 @@ vector<Direction> Vertex::getDirections(Kmer*vertex){
 	#endif
 
 	while(e!=NULL){
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(e!=NULL);
 		#endif
 
@@ -243,7 +243,7 @@ vector<Direction> Vertex::getDirections(Kmer*vertex){
 		e=e->getNext();
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(e==NULL);
 	#endif
 
@@ -365,7 +365,7 @@ uint8_t Vertex::swapBits(uint8_t map,int bit1,int bit2) const {
 	int bit1Value=((uint64_t)map<<(63-bit1))>>63;
 	int bit2Value=((uint64_t)map<<(63-bit2))>>63;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(bit1>=0);
 	assert(bit1<8);
 	assert(bit2>=0);
@@ -378,7 +378,7 @@ uint8_t Vertex::swapBits(uint8_t map,int bit1,int bit2) const {
 	if(bit1Value==bit2Value)
 		return map;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	if(bit1Value+bit2Value!=1){
 		cout<<"bit values: "<<bit1Value<<" "<<bit2Value<<endl;
 	}
@@ -400,7 +400,7 @@ uint8_t Vertex::swapBits(uint8_t map,int bit1,int bit2) const {
 		map&=~(1<<bit2);
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	int newBit1Value=((uint64_t)map<<(63-bit1))>>63;
 	int newBit2Value=((uint64_t)map<<(63-bit2))>>63;
 
diff --git a/code/VerticesExtractor/VerticesExtractor.cpp b/code/VerticesExtractor/VerticesExtractor.cpp
index 468fdc1..5dba9e1 100644
--- a/code/VerticesExtractor/VerticesExtractor.cpp
+++ b/code/VerticesExtractor/VerticesExtractor.cpp
@@ -63,7 +63,7 @@ void VerticesExtractor::call_RAY_SLAVE_MODE_ADD_EDGES(){
 		}
 	}
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pendingMessages>=0);
 	#endif
 	if(m_pendingMessages!=0){
@@ -92,7 +92,7 @@ void VerticesExtractor::call_RAY_SLAVE_MODE_ADD_EDGES(){
 		flushAll(m_outboxAllocator,m_outbox,m_parameters->getRank());
 
 		if(m_pendingMessages==0){
-			#ifdef ASSERT
+			#ifdef CONFIG_ASSERT
 			assert(m_bufferedDataForIngoingEdges.isEmpty());
 			assert(m_bufferedDataForOutgoingEdges.isEmpty());
 			#endif
@@ -135,7 +135,7 @@ void VerticesExtractor::call_RAY_SLAVE_MODE_ADD_EDGES(){
 
 		int maximumPosition=len-m_parameters->getWordSize()+1;
 		
-		#ifdef ASSERT
+		#ifdef CONFIG_ASSERT
 		assert(m_readSequence!=NULL);
 		#endif
 
@@ -341,7 +341,7 @@ void VerticesExtractor::constructor(int size,Parameters*parameters,GridTable*gra
 }
 
 void VerticesExtractor::setReadiness(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_pendingMessages>0);
 	#endif
 
@@ -381,7 +381,7 @@ void VerticesExtractor::incrementPendingMessages(){
 }
 
 void VerticesExtractor::showBuffers(){
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	assert(m_bufferedDataForOutgoingEdges.isEmpty());
 	assert(m_bufferedDataForIngoingEdges.isEmpty());
 	#endif
diff --git a/code/application_core/Machine.cpp b/code/application_core/Machine.cpp
index 2f19d5e..a99fa1e 100644
--- a/code/application_core/Machine.cpp
+++ b/code/application_core/Machine.cpp
@@ -673,7 +673,7 @@ for i in $(cat list ); do exp="s/option/$i/g"; sed $exp content; done > list2
 	cout<<endl;
 
 	cout<<"ASSERT = ";
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	cout<<"y";
 	#else
 	cout<<"n";
diff --git a/code/application_core/Machine.h b/code/application_core/Machine.h
index 99aa34b..56ace9b 100644
--- a/code/application_core/Machine.h
+++ b/code/application_core/Machine.h
@@ -275,7 +275,7 @@ class Machine : public MiniRank{
 	bool m_FINISH_hits_computed;
 	int m_FINISH_hit;
 
-	#ifdef ASSERT
+	#ifdef CONFIG_ASSERT
 	set<int> m_collisions;
 	#endif
 	bool m_reductionOccured;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/ray.git



More information about the debian-med-commit mailing list