Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision 4cc9b13dc2db7b8a44af9143406aa8fd30bec6d3)
+++ src/libcfa/concurrency/monitor.c	(revision 19c43b7eb5e375d3769f89869c10265cdd9ef030)
@@ -72,9 +72,4 @@
 #define monitor_restore restore( monitors, count, locks, recursions, masks )
 
-#define blockAndWake( thrd, cnt )                               /* Create the necessary information to use the signaller stack                         */ \
-	monitor_save;                                             /* Save monitor states                                                                 */ \
-	BlockInternal( locks, count, thrd, cnt );                 /* Everything is ready to go to sleep                                                  */ \
-	monitor_restore;                                          /* We are back, restore the owners and recursions                                      */ \
-
 
 //-----------------------------------------------------------------------------
@@ -229,5 +224,5 @@
 	this_thread->monitors.func = func;
 
-	LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count);
+	// LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count);
 
 	// Enter the monitors in order
@@ -235,5 +230,5 @@
 	enter( group );
 
-	LIB_DEBUG_PRINT_SAFE("MGUARD : entered\n");
+	// LIB_DEBUG_PRINT_SAFE("MGUARD : entered\n");
 }
 
@@ -241,10 +236,10 @@
 // Dtor for monitor guard
 void ^?{}( monitor_guard_t & this ) {
-	LIB_DEBUG_PRINT_SAFE("MGUARD : leaving %d\n", this.count);
+	// LIB_DEBUG_PRINT_SAFE("MGUARD : leaving %d\n", this.count);
 
 	// Leave the monitors in order
 	leave( this.m, this.count );
 
-	LIB_DEBUG_PRINT_SAFE("MGUARD : left\n");
+	// LIB_DEBUG_PRINT_SAFE("MGUARD : left\n");
 
 	// Restore thread context
@@ -425,4 +420,6 @@
 // 		block
 void __waitfor_internal( const __waitfor_mask_t & mask, int duration ) {
+	LIB_DEBUG_PRINT_SAFE("Kernel : waitfor internal \n");
+
 	// This statment doesn't have a contiguous list of monitors...
 	// Create one!
@@ -431,5 +428,10 @@
 	short actual_count = aggregate( mon_storage, mask );
 
-	if(actual_count == 0) return;
+	if(actual_count == 0) {
+		LIB_DEBUG_PRINT_SAFE("Kernel :  nothing to wait for \n");
+		return;
+	}
+
+	LIB_DEBUG_PRINT_SAFE("Kernel : waitfor internal proceeding\n");
 
 	// Create storage for monitor context
@@ -445,12 +447,32 @@
 
 		if( next ) {
+			*mask.accepted = index;
 			if( mask.clauses[index].is_dtor ) {
 				#warning case not implemented
 			}
 			else {
-				blockAndWake( &next, 1 );
+				LIB_DEBUG_PRINT_SAFE("Kernel : thread present, baton-passing\n");
+
+				// Create the node specific to this wait operation
+				wait_ctx_primed( this_thread, 0 );
+
+				// Save monitor states
+				monitor_save;
+
+				// Set the owners to be the next thread
+				set_owner( monitors, count, next );
+
+				// Everything is ready to go to sleep
+				BlockInternal( locks, count, &next, 1 );
+
+				// We are back, restore the owners and recursions
+				monitor_restore;
+
+				LIB_DEBUG_PRINT_SAFE("Kernel : thread present, returned\n");
 			}
 
-			return index;
+			LIB_DEBUG_PRINT_SAFE("Kernel : accepted %d\n", *mask.accepted);
+
+			return;
 		}
 	}
@@ -458,5 +480,9 @@
 
 	if( duration == 0 ) {
+		LIB_DEBUG_PRINT_SAFE("Kernel : non-blocking, exiting\n");
+
 		unlock_all( locks, count );
+
+		LIB_DEBUG_PRINT_SAFE("Kernel : accepted %d\n", *mask.accepted);
 		return;
 	}
@@ -465,11 +491,25 @@
 	verifyf( duration < 0, "Timeout on waitfor statments not supported yet.");
 
+	LIB_DEBUG_PRINT_SAFE("Kernel : blocking waitfor\n");
+
+	// Create the node specific to this wait operation
+	wait_ctx_primed( this_thread, 0 );
 
 	monitor_save;
 	set_mask( monitors, count, mask );
 
-	BlockInternal( locks, count );       // Everything is ready to go to sleep
-	//WE WOKE UP
-	monitor_restore;                     //We are back, restore the masks and recursions
+	//Everything is ready to go to sleep
+	BlockInternal( locks, count );
+
+
+	// WE WOKE UP
+
+
+	//We are back, restore the masks and recursions
+	monitor_restore;
+
+	LIB_DEBUG_PRINT_SAFE("Kernel : exiting\n");
+
+	LIB_DEBUG_PRINT_SAFE("Kernel : accepted %d\n", *mask.accepted);
 }
 
@@ -478,5 +518,5 @@
 
 static inline void set_owner( monitor_desc * this, thread_desc * owner ) {
-	LIB_DEBUG_PRINT_SAFE("Kernal :   Setting owner of %p to %p ( was %p)\n", this, owner, this->owner );
+	// LIB_DEBUG_PRINT_SAFE("Kernal :   Setting owner of %p to %p ( was %p)\n", this, owner, this->owner );
 
 	//Pass the monitor appropriately
@@ -559,15 +599,25 @@
 
 static inline void lock_all( spinlock ** locks, unsigned short count ) {
+	LIB_DEBUG_ACQUIRE();
+	LIB_DEBUG_PRINT_NOLOCK("Kernel :   Locking");
 	for( int i = 0; i < count; i++ ) {
+		LIB_DEBUG_PRINT_NOLOCK(" %p", locks[i]);
 		lock_yield( locks[i] DEBUG_CTX2 );
 	}
+	LIB_DEBUG_PRINT_NOLOCK("\n");
+	LIB_DEBUG_RELEASE();
 }
 
 static inline void lock_all( monitor_desc ** source, spinlock ** /*out*/ locks, unsigned short count ) {
+	LIB_DEBUG_ACQUIRE();
+	LIB_DEBUG_PRINT_NOLOCK("Kernel :   Locking");
 	for( int i = 0; i < count; i++ ) {
 		spinlock * l = &source[i]->lock;
+		LIB_DEBUG_PRINT_NOLOCK(" %p", l);
 		lock_yield( l DEBUG_CTX2 );
 		if(locks) locks[i] = l;
 	}
+	LIB_DEBUG_PRINT_NOLOCK("\n");
+	LIB_DEBUG_RELEASE();
 }
 
