diff --git a/Makefile b/Makefile
index c8a0838910f6061f84fdf1bbe0d9a635a02ec6ba..0f1d2941db42d9efeb11bde65bd9dd2ffcbb9118 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,7 @@ test:
 	$(MAKE) $(TESTD)/test
 	$(MAKE) $(TESTD)/test2
 	$(MAKE) $(TESTD)/test3
+	$(MAKE) $(TESTD)/test4
 
 .PHONY: dots
 dots:
diff --git a/include/mpi_collective.hpp b/include/mpi_collective.hpp
index b66fda1017ae0796108a845d43248dbec82c99c6..f019236ae94557d814e9035df203dbe995b58a0e 100644
--- a/include/mpi_collective.hpp
+++ b/include/mpi_collective.hpp
@@ -129,7 +129,9 @@ public:
 	void get_mpi_coll_rank(
 	    function *fun, int rank, int mpi_code, bitmap mpi_coll);
 	// raise warnings when mpi collective are badly uses
-	void raise_warning_if_mpi_wrong(function *fun);
+	void raise_warning_mpi_rank(function *fun);
+	void raise_warning_mpi_order(function *fun);
+	basic_block get_bb_from_index(function *fun, int index);
 
 	//
 	// mpi collective graphviz
diff --git a/src/mpi_collective_pass.cpp b/src/mpi_collective_pass.cpp
index 43b9420c26e7ddc9d24a47f20169bcb31a757c4a..6325e9321911b3909ff17395ab1dfd9fbe3327bd 100644
--- a/src/mpi_collective_pass.cpp
+++ b/src/mpi_collective_pass.cpp
@@ -43,22 +43,21 @@ pass_mpi_collective *pass_mpi_collective::clone()
 
 bool pass_mpi_collective::gate(function *fun)
 {
-	//printf("In gate of: %s\n", fndecl_name(fun->decl));
-	printf("In gate of: %s\n", function_name(fun));
-	//printf("In gate of: %s\n", current_function_name());
+	(void) fun;
+	//printf("In gate of: %s\n", function_name(fun));
 	return true;
 }
 
 unsigned int pass_mpi_collective::execute(function *fun)
 {
+	//printf("In execute of: %s\n", function_name(fun));
+
 	// need because pass objectis reused
 	for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; ++i)
 	{
 		collective_max_rank[i] = 0;
 	}
 
-	printf("In execute of: %s\n", function_name(fun));
-
 	//print_tree(fun);
 	split_blocks(fun);
 	//printf("\t--------------------------[split]---------------------------\n");
@@ -87,8 +86,8 @@ unsigned int pass_mpi_collective::execute(function *fun)
 
 	cfgviz_dump(fun, "_split");
 
-	printf("[][][][][][][][][][]\n");
-	raise_warning_if_mpi_wrong(fun);
+	raise_warning_mpi_rank(fun);
+	raise_warning_mpi_order(fun);
 
 	free_dom_data();
 	free_bb_aux(fun);
diff --git a/src/mpi_collective_warnings.cpp b/src/mpi_collective_warnings.cpp
index 75c1183bd2b4c2a89c82741ac0722addb8fd62cb..f1630118f7082d245e1f670e94749589052b8d36 100644
--- a/src/mpi_collective_warnings.cpp
+++ b/src/mpi_collective_warnings.cpp
@@ -41,7 +41,7 @@ void pass_mpi_collective::__rank_collective(basic_block bb)
 				    std::max(collective_max_rank[mpi_code],
 				             ((bb_data *) bb->aux)->collective_rank[mpi_code]);
 				//printf("collective max rank for %i up to %i\n",
-				//       mpi_code, collective_max_rank[mpi_code]);
+				//		 mpi_code, collective_max_rank[mpi_code]);
 			}
 		}
 	}
@@ -118,46 +118,61 @@ void pass_mpi_collective::get_mpi_coll_rank(function *fun,
 	}
 }
 
-void pass_mpi_collective::raise_warning_if_mpi_wrong(function *fun)
+void pass_mpi_collective::raise_warning_mpi_rank(function *fun)
 {
-	for (int mpi_code = 0; mpi_code < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE;
-	     ++mpi_code)
-	{
-		bitmap_head pds_head;
-		bitmap_head pdf_head;
-		bitmap_head nodes_head;
+	int mpi_code;
+
+	bitmap_head pds_head;
+	bitmap_head pdf_head;
+	bitmap_head nodes_head;
+
+	bitmap pds = &pds_head;
+	bitmap pdf = &pdf_head;
+	bitmap nodes = &nodes_head;
+	bitmap tmp = NULL;
 
-		bitmap pds = &pds_head;
-		bitmap pdf = &pdf_head;
-		bitmap nodes = &nodes_head;
-		bitmap tmp = NULL;
+	bitmap_initialize(pds, &bitmap_default_obstack);
+	bitmap_initialize(pdf, &bitmap_default_obstack);
+	bitmap_initialize(nodes, &bitmap_default_obstack);
 
-		bitmap_initialize(pds, &bitmap_default_obstack);
-		bitmap_initialize(pdf, &bitmap_default_obstack);
-		bitmap_initialize(nodes, &bitmap_default_obstack);
-		int stop = 0;
+	bitmap_iterator bi;
+	unsigned int index;
+
+	for (mpi_code = 0; mpi_code < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE;
+	     ++mpi_code)
+	{
 
-		for (int i = 1 ; i < collective_max_rank[mpi_code] + 1 ; i++)
+		for (int rank = 1 ; rank < collective_max_rank[mpi_code] + 1 ; rank++)
 		{
-			printf("mpi_code: %i at rank: %i\n", mpi_code, i);
+			//printf("mpi_code: %i at rank: %i\n", mpi_code, i);
 			// DONE: split in 2, get mpi set & find set post dom
-			get_mpi_coll_rank(fun, i, mpi_code, nodes);
+			get_mpi_coll_rank(fun, rank, mpi_code, nodes);
 			get_post_dom_bitmap(fun, nodes, pds);
 			get_post_dom_frontier(fun, pds, pdf);
 
-			printf("----\n");
-			debug_bitmap(nodes);
-			debug_bitmap(pds);
-			debug_bitmap(pdf);
+			//printf("----\n");
+			//debug_bitmap(nodes);
+			//debug_bitmap(pds);
+			//debug_bitmap(pdf);
 
-			while (! bitmap_empty_p(pdf))
+			if (! bitmap_empty_p(pdf))
 			{
-				stop++;
-				if (stop > 10)
-				{ return; }
+				// TODO make better warning messages
+				printf("Mpi Collective %s incomplete rank at bbs: ",
+				       mpi_collective_name[mpi_code]);
+				EXECUTE_IF_SET_IN_BITMAP(nodes, 0, index, bi)
+				{
+					printf("%i, ", index);
+				}
+				printf("\n");
+			}
 
-				printf("WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-				// print warning here
+			while (! bitmap_empty_p(pdf))
+			{
+				EXECUTE_IF_SET_IN_BITMAP(pdf, 0, index, bi)
+				{
+					printf("Divergence from bb %i\n", index);
+				}
 
 				bitmap_clear(nodes);
 				bitmap_clear(pds);
@@ -171,10 +186,10 @@ void pass_mpi_collective::raise_warning_if_mpi_wrong(function *fun)
 				get_post_dom_bitmap(fun, nodes, pds);
 				get_post_dom_frontier(fun, pds, pdf);
 
-				printf("----\n");
-				debug_bitmap(nodes);
-				debug_bitmap(pds);
-				debug_bitmap(pdf);
+				//printf("----\n");
+				//debug_bitmap(nodes);
+				//debug_bitmap(pds);
+				//debug_bitmap(pdf);
 			}
 			bitmap_clear(nodes);
 			bitmap_clear(pds);
@@ -183,3 +198,89 @@ void pass_mpi_collective::raise_warning_if_mpi_wrong(function *fun)
 	}
 }
 
+basic_block pass_mpi_collective::get_bb_from_index(function *fun, int index)
+{
+	basic_block bb;
+
+	FOR_ALL_BB_FN(bb, fun)
+	{
+		if (bb->index == index)
+		{
+			return bb;
+		}
+	}
+
+	return NULL;
+}
+
+void pass_mpi_collective::raise_warning_mpi_order(function *fun)
+{
+	int mpi_code;
+	int rank;
+
+	bitmap_head nodes_head;
+	bitmap nodes = &nodes_head;
+	bitmap_initialize(nodes, &bitmap_default_obstack);
+
+	int cursor_code;
+	bitmap_iterator bi;
+	unsigned int index;
+
+	int curr_coll_rank;
+	bool coll_rank_diff;
+	int other_coll_rank;
+
+	for (mpi_code = 0; mpi_code < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE;
+	     ++mpi_code)
+	{
+		for (rank = 1; rank < collective_max_rank[mpi_code] + 1 ; rank++)
+		{
+			//printf("mpi_code: %i at rank: %i\n", mpi_code, i);
+			// DONE: split in 2, get mpi set & find set post dom
+			get_mpi_coll_rank(fun, rank, mpi_code, nodes);
+			//debug_bitmap(nodes);
+
+			for (cursor_code = 0;
+			     cursor_code < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE;
+			     cursor_code++)
+			{
+				if (mpi_code == cursor_code)
+				{
+					continue;
+				}
+
+				curr_coll_rank = -1;
+				coll_rank_diff = false;
+
+				EXECUTE_IF_SET_IN_BITMAP(nodes, 0, index, bi)
+				{
+					other_coll_rank =
+					    ((bb_data *) get_bb_from_index(fun, index)->aux)
+					    ->collective_rank[cursor_code];
+					//printf("bb %i as mpi code %i and mpi rank %i\n",
+					//		index, cursor_code, other_coll_rank);
+					if (curr_coll_rank == -1)
+					{
+						curr_coll_rank = other_coll_rank;
+					}
+					else if (curr_coll_rank != other_coll_rank)
+					{
+						coll_rank_diff = true;
+					}
+				}
+
+				if (coll_rank_diff)
+				{
+					// TODO make better warning messages
+					printf("======> WARNING !!! ====> MPI "
+					       "Colelctive rank missmatch for collective %s"
+					       " at MPI Collective %s at rank %i\n",
+					       mpi_collective_name[cursor_code],
+					       mpi_collective_name[mpi_code], rank);
+				}
+			}
+
+			bitmap_clear(nodes);
+		}
+	}
+}