Index: src/Common/VectorMap.h
===================================================================
--- src/Common/VectorMap.h	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/Common/VectorMap.h	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// ScopedMap.h --
+// VectorMap.h --
 //
 // Author           : Aaron B. Moss
Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/GenPoly/Box.cc	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -202,5 +202,5 @@
 		};
 
-		/// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable
+		/// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, sizeof expressions of polymorphic types with the proper variable, and strips fields from generic struct declarations.
 		class Pass3 final : public PolyMutator {
 		  public:
@@ -210,4 +210,6 @@
 			using PolyMutator::mutate;
 			virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
+			virtual Declaration *mutate( StructDecl *structDecl ) override;
+			virtual Declaration *mutate( UnionDecl *unionDecl ) override;
 			virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override;
 			virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override;
@@ -1868,4 +1870,19 @@
 		}
 
+		/// Strips the members from a generic aggregate
+		void stripGenericMembers(AggregateDecl* decl) {
+			if ( ! decl->get_parameters().empty() ) decl->get_members().clear();
+		}
+
+		Declaration *Pass3::mutate( StructDecl *structDecl ) {
+			stripGenericMembers( structDecl );
+			return structDecl;
+		}
+		
+		Declaration *Pass3::mutate( UnionDecl *unionDecl ) {
+			stripGenericMembers( unionDecl );
+			return unionDecl;
+		}
+
 		TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) {
 //   Initializer *init = 0;
Index: src/libcfa/concurrency/alarm.c
===================================================================
--- src/libcfa/concurrency/alarm.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/alarm.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -31,4 +31,42 @@
 
 //=============================================================================================
+// time type
+//=============================================================================================
+
+#define one_second         1_000_000_000ul
+#define one_milisecond         1_000_000ul
+#define one_microsecond            1_000ul
+#define one_nanosecond                 1ul
+
+__cfa_time_t zero_time = { 0 };
+
+void ?{}( __cfa_time_t * this ) { this->val = 0; }
+void ?{}( __cfa_time_t * this, zero_t zero ) { this->val = 0; }
+
+void ?{}( itimerval * this, __cfa_time_t * alarm ) {
+	this->it_value.tv_sec = alarm->val / one_second;			// seconds
+	this->it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds
+	this->it_interval.tv_sec = 0;
+	this->it_interval.tv_usec = 0;
+}
+
+
+void ?{}( __cfa_time_t * this, timespec * curr ) {
+	uint64_t secs  = curr->tv_sec;
+	uint64_t nsecs = curr->tv_nsec;
+	this->val = (secs * one_second) + nsecs;
+}
+
+__cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs ) {
+	this->val = 0;
+	return *this;
+}
+
+__cfa_time_t from_s ( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000_000_000ul; return ret; }
+__cfa_time_t from_ms( uint64_t val ) { __cfa_time_t ret; ret.val = val *     1_000_000ul; return ret; }
+__cfa_time_t from_us( uint64_t val ) { __cfa_time_t ret; ret.val = val *         1_000ul; return ret; }
+__cfa_time_t from_ns( uint64_t val ) { __cfa_time_t ret; ret.val = val *             1ul; return ret; }
+
+//=============================================================================================
 // Clock logic
 //=============================================================================================
@@ -37,16 +75,9 @@
 	timespec curr;
 	clock_gettime( CLOCK_REALTIME, &curr );
-	__cfa_time_t curr_time = ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec;
-	// LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : current time is %lu\n", curr_time );
-	return curr_time;
+	return (__cfa_time_t){ &curr };
 }
 
 void __kernel_set_timer( __cfa_time_t alarm ) {
-	LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : set timer to %llu\n", (__cfa_time_t)alarm );
-	itimerval val;
-	val.it_value.tv_sec = alarm / TIMEGRAN;			// seconds
-	val.it_value.tv_usec = max( (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ), 1000 ); // microseconds
-	val.it_interval.tv_sec = 0;
-	val.it_interval.tv_usec = 0;
+	itimerval val = { &alarm };
 	setitimer( ITIMER_REAL, &val, NULL );
 }
@@ -56,5 +87,5 @@
 //=============================================================================================
 
-void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
+void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
 	this->thrd = thrd;
 	this->alarm = alarm;
@@ -65,5 +96,5 @@
 }
 
-void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
+void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
 	this->proc = proc;
 	this->alarm = alarm;
@@ -153,20 +184,18 @@
 
 void register_self( alarm_node_t * this ) {
+	alarm_list_t * alarms = &event_kernel->alarms;
+
 	disable_interrupts();
-	verify( !systemProcessor->pending_alarm );
-	lock( &systemProcessor->alarm_lock DEBUG_CTX2 );
+	lock( &event_kernel->lock DEBUG_CTX2 );
 	{
-		verify( validate( &systemProcessor->alarms ) );
-		bool first = !systemProcessor->alarms.head;
-
-		insert( &systemProcessor->alarms, this );
-		if( systemProcessor->pending_alarm ) {
-			tick_preemption();
+		verify( validate( alarms ) );
+		bool first = !alarms->head;
+
+		insert( alarms, this );
+		if( first ) {
+			__kernel_set_timer( alarms->head->alarm - __kernel_get_time() );
 		}
-		if( first ) {
-			__kernel_set_timer( systemProcessor->alarms.head->alarm - __kernel_get_time() );
-		}
-	}
-	unlock( &systemProcessor->alarm_lock );
+	}
+	unlock( &event_kernel->lock );
 	this->set = true;
 	enable_interrupts( DEBUG_CTX );
@@ -174,14 +203,12 @@
 
 void unregister_self( alarm_node_t * this ) {
-	// LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : unregister %p start\n", this );
 	disable_interrupts();
-	lock( &systemProcessor->alarm_lock DEBUG_CTX2 );
+	lock( &event_kernel->lock DEBUG_CTX2 );
 	{
-		verify( validate( &systemProcessor->alarms ) );
-		remove( &systemProcessor->alarms, this );
-	}
-	unlock( &systemProcessor->alarm_lock );
+		verify( validate( &event_kernel->alarms ) );
+		remove( &event_kernel->alarms, this );
+	}
+	unlock( &event_kernel->lock );
 	enable_interrupts( DEBUG_CTX );
 	this->set = false;
-	// LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Kernel : unregister %p end\n", this );
-}
+}
Index: src/libcfa/concurrency/alarm.h
===================================================================
--- src/libcfa/concurrency/alarm.h	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/alarm.h	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -23,14 +23,64 @@
 #include "assert"
 
-typedef uint64_t __cfa_time_t;
-
 struct thread_desc;
 struct processor;
+
+struct timespec;
+struct itimerval;
+
+//=============================================================================================
+// time type
+//=============================================================================================
+
+struct __cfa_time_t {
+	uint64_t val;
+};
+
+// ctors
+void ?{}( __cfa_time_t * this );
+void ?{}( __cfa_time_t * this, zero_t zero );
+void ?{}( __cfa_time_t * this, timespec * curr );
+void ?{}( itimerval * this, __cfa_time_t * alarm );
+
+__cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs );
+
+// logical ops
+static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }
+static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }
+static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >  rhs.val; }
+static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <  rhs.val; }
+static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }
+static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }
+
+static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }
+static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }
+static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >  rhs; }
+static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <  rhs; }
+static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }
+static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }
+
+// addition/substract
+static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {
+	__cfa_time_t ret;
+	ret.val = lhs.val + rhs.val;
+	return ret;
+}
+
+static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {
+	__cfa_time_t ret;
+	ret.val = lhs.val - rhs.val;
+	return ret;
+}
+
+__cfa_time_t from_s ( uint64_t );
+__cfa_time_t from_ms( uint64_t );
+__cfa_time_t from_us( uint64_t );
+__cfa_time_t from_ns( uint64_t );
+
+extern __cfa_time_t zero_time;
 
 //=============================================================================================
 // Clock logic
 //=============================================================================================
-
-#define TIMEGRAN 1_000_000_000L				// nanosecond granularity, except for timeval
 
 __cfa_time_t __kernel_get_time();
@@ -57,6 +107,6 @@
 typedef alarm_node_t ** __alarm_it_t;
 
-void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
-void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
+void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
+void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
 void ^?{}( alarm_node_t * this );
 
Index: src/libcfa/concurrency/coroutine
===================================================================
--- src/libcfa/concurrency/coroutine	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/coroutine	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -63,5 +63,5 @@
 
 // Get current coroutine
-extern volatile thread_local coroutine_desc * this_coroutine;
+extern thread_local coroutine_desc * volatile this_coroutine;
 
 // Private wrappers for context switch and stack creation
Index: src/libcfa/concurrency/coroutine.c
===================================================================
--- src/libcfa/concurrency/coroutine.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/coroutine.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -26,11 +26,9 @@
 }
 
-#include "kernel"
-#include "libhdr.h"
+#include "kernel_private.h"
 
 #define __CFA_INVOKE_PRIVATE__
 #include "invoke.h"
 
-extern volatile thread_local processor * this_processor;
 
 //-----------------------------------------------------------------------------
Index: src/libcfa/concurrency/kernel
===================================================================
--- src/libcfa/concurrency/kernel	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/kernel	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -28,8 +28,8 @@
 //-----------------------------------------------------------------------------
 // Locks
-bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );
-void lock      ( spinlock * DEBUG_CTX_PARAM2 );
-void lock_yield( spinlock * DEBUG_CTX_PARAM2 );
-void unlock    ( spinlock * );
+void lock      ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, spin if already acquired
+void lock_yield( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, yield repeatedly if already acquired
+bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, return false if already acquired
+void unlock    ( spinlock * );                        // Unlock the spinlock
 
 struct semaphore {
@@ -48,6 +48,7 @@
 // Cluster
 struct cluster {
-	__thread_queue_t ready_queue;
-	spinlock lock;
+	spinlock ready_queue_lock;                      // Ready queue locks
+	__thread_queue_t ready_queue;                   // Ready queue for threads
+	unsigned long long int preemption;              // Preemption rate on this cluster
 };
 
@@ -76,20 +77,26 @@
 static inline void ^?{}(FinishAction * this) {}
 
+// Processor
+// Wrapper around kernel threads
 struct processor {
-	struct processorCtx_t * runner;
-	cluster * cltr;
-	pthread_t kernel_thread;
+	// Main state
+	struct processorCtx_t * runner;                 // Coroutine ctx who does keeps the state of the processor
+	cluster * cltr;                                 // Cluster from which to get threads
+	pthread_t kernel_thread;                        // Handle to pthreads
 
-	semaphore terminated;
-	volatile bool is_terminated;
+	// Termination
+	volatile bool do_terminate;                     // Set to true to notify the processor should terminate
+	semaphore terminated;                           // Termination synchronisation
 
-	struct FinishAction finish;
+	// RunThread data
+	struct FinishAction finish;                     // Action to do after a thread is ran
 
-	struct alarm_node_t * preemption_alarm;
-	unsigned int preemption;
+	// Preemption data
+	struct alarm_node_t * preemption_alarm;         // Node which is added in the discrete event simulaiton
+	bool pending_preemption;                        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
 
-	bool pending_preemption;
-
-	char * last_enable;
+#ifdef __CFA_DEBUG__
+	char * last_enable;                             // Last function to enable preemption on this processor
+#endif
 };
 
Index: src/libcfa/concurrency/kernel.c
===================================================================
--- src/libcfa/concurrency/kernel.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/kernel.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -42,14 +42,12 @@
 //-----------------------------------------------------------------------------
 // Kernel storage
-#define KERNEL_STORAGE(T,X) static char X##Storage[sizeof(T)]
-
-KERNEL_STORAGE(processorCtx_t, systemProcessorCtx);
-KERNEL_STORAGE(cluster, systemCluster);
-KERNEL_STORAGE(system_proc_t, systemProcessor);
-KERNEL_STORAGE(thread_desc, mainThread);
+KERNEL_STORAGE(cluster,           mainCluster);
+KERNEL_STORAGE(processor,         mainProcessor);
+KERNEL_STORAGE(processorCtx_t,    mainProcessorCtx);
+KERNEL_STORAGE(thread_desc,       mainThread);
 KERNEL_STORAGE(machine_context_t, mainThreadCtx);
 
-cluster * systemCluster;
-system_proc_t * systemProcessor;
+cluster *     mainCluster;
+processor *   mainProcessor;
 thread_desc * mainThread;
 
@@ -57,7 +55,8 @@
 // Global state
 
-volatile thread_local processor * this_processor;
-volatile thread_local coroutine_desc * this_coroutine;
-volatile thread_local thread_desc * this_thread;
+thread_local coroutine_desc * volatile this_coroutine;
+thread_local thread_desc *    volatile this_thread;
+thread_local processor *      volatile this_processor;
+
 volatile thread_local bool preemption_in_progress = 0;
 volatile thread_local unsigned short disable_preempt_count = 1;
@@ -85,5 +84,5 @@
 
 	this->limit = (void *)(((intptr_t)this->base) - this->size);
-	this->context = &mainThreadCtxStorage;
+	this->context = &storage_mainThreadCtx;
 	this->top = this->base;
 }
@@ -125,5 +124,5 @@
 
 void ?{}(processor * this) {
-	this{ systemCluster };
+	this{ mainCluster };
 }
 
@@ -131,7 +130,6 @@
 	this->cltr = cltr;
 	(&this->terminated){ 0 };
-	this->is_terminated = false;
+	this->do_terminate = false;
 	this->preemption_alarm = NULL;
-	this->preemption = default_preemption();
 	this->pending_preemption = false;
 
@@ -142,31 +140,18 @@
 	this->cltr = cltr;
 	(&this->terminated){ 0 };
-	this->is_terminated = false;
+	this->do_terminate = false;
 	this->preemption_alarm = NULL;
-	this->preemption = default_preemption();
 	this->pending_preemption = false;
 	this->kernel_thread = pthread_self();
 
 	this->runner = runner;
-	LIB_DEBUG_PRINT_SAFE("Kernel : constructing system processor context %p\n", runner);
+	LIB_DEBUG_PRINT_SAFE("Kernel : constructing main processor context %p\n", runner);
 	runner{ this };
 }
 
-LIB_DEBUG_DO( bool validate( alarm_list_t * this ); )
-
-void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) {
-	(&this->alarms){};
-	(&this->alarm_lock){};
-	this->pending_alarm = false;
-
-	(&this->proc){ cltr, runner };
-
-	verify( validate( &this->alarms ) );
-}
-
 void ^?{}(processor * this) {
-	if( ! this->is_terminated ) {
+	if( ! this->do_terminate ) {
 		LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this);
-		this->is_terminated = true;
+		this->do_terminate = true;
 		P( &this->terminated );
 		pthread_join( this->kernel_thread, NULL );
@@ -176,5 +161,7 @@
 void ?{}(cluster * this) {
 	( &this->ready_queue ){};
-	( &this->lock ){};
+	( &this->ready_queue_lock ){};
+
+	this->preemption = default_preemption();
 }
 
@@ -199,5 +186,5 @@
 
 		thread_desc * readyThread = NULL;
-		for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )
+		for( unsigned int spin_count = 0; ! this->do_terminate; spin_count++ )
 		{
 			readyThread = nextThread( this->cltr );
@@ -343,7 +330,7 @@
 	verifyf( thrd->next == NULL, "Expected null got %p", thrd->next );
 
-	lock( &systemProcessor->proc.cltr->lock DEBUG_CTX2 );
-	append( &systemProcessor->proc.cltr->ready_queue, thrd );
-	unlock( &systemProcessor->proc.cltr->lock );
+	lock(   &this_processor->cltr->ready_queue_lock DEBUG_CTX2 );
+	append( &this_processor->cltr->ready_queue, thrd );
+	unlock( &this_processor->cltr->ready_queue_lock );
 
 	verify( disable_preempt_count > 0 );
@@ -352,7 +339,7 @@
 thread_desc * nextThread(cluster * this) {
 	verify( disable_preempt_count > 0 );
-	lock( &this->lock DEBUG_CTX2 );
+	lock( &this->ready_queue_lock DEBUG_CTX2 );
 	thread_desc * head = pop_head( &this->ready_queue );
-	unlock( &this->lock );
+	unlock( &this->ready_queue_lock );
 	verify( disable_preempt_count > 0 );
 	return head;
@@ -452,6 +439,6 @@
 	// Start by initializing the main thread
 	// SKULLDUGGERY: the mainThread steals the process main thread
-	// which will then be scheduled by the systemProcessor normally
-	mainThread = (thread_desc *)&mainThreadStorage;
+	// which will then be scheduled by the mainProcessor normally
+	mainThread = (thread_desc *)&storage_mainThread;
 	current_stack_info_t info;
 	mainThread{ &info };
@@ -459,32 +446,31 @@
 	LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n");
 
-	// Initialize the system cluster
-	systemCluster = (cluster *)&systemClusterStorage;
-	systemCluster{};
-
-	LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n");
-
-	// Initialize the system processor and the system processor ctx
+	// Initialize the main cluster
+	mainCluster = (cluster *)&storage_mainCluster;
+	mainCluster{};
+
+	LIB_DEBUG_PRINT_SAFE("Kernel : main cluster ready\n");
+
+	// Initialize the main processor and the main processor ctx
 	// (the coroutine that contains the processing control flow)
-	systemProcessor = (system_proc_t *)&systemProcessorStorage;
-	systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtxStorage };
-
-	// Add the main thread to the ready queue
-	// once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread
-	ScheduleThread(mainThread);
+	mainProcessor = (processor *)&storage_mainProcessor;
+	mainProcessor{ mainCluster, (processorCtx_t *)&storage_mainProcessorCtx };
 
 	//initialize the global state variables
-	this_processor = &systemProcessor->proc;
+	this_processor = mainProcessor;
 	this_thread = mainThread;
 	this_coroutine = &mainThread->cor;
-	disable_preempt_count = 1;
 
 	// Enable preemption
 	kernel_start_preemption();
 
-	// SKULLDUGGERY: Force a context switch to the system processor to set the main thread's context to the current UNIX
+	// Add the main thread to the ready queue
+	// once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread
+	ScheduleThread(mainThread);
+
+	// SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX
 	// context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that
 	// mainThread is on the ready queue when this call is made.
-	resume( systemProcessor->proc.runner );
+	resume( mainProcessor->runner );
 
 
@@ -501,8 +487,8 @@
 	disable_interrupts();
 
-	// SKULLDUGGERY: Notify the systemProcessor it needs to terminates.
+	// SKULLDUGGERY: Notify the mainProcessor it needs to terminates.
 	// When its coroutine terminates, it return control to the mainThread
 	// which is currently here
-	systemProcessor->proc.is_terminated = true;
+	mainProcessor->do_terminate = true;
 	suspend();
 
@@ -512,8 +498,8 @@
 	kernel_stop_preemption();
 
-	// Destroy the system processor and its context in reverse order of construction
+	// Destroy the main processor and its context in reverse order of construction
 	// These were manually constructed so we need manually destroy them
-	^(systemProcessor->proc.runner){};
-	^(systemProcessor){};
+	^(mainProcessor->runner){};
+	^(mainProcessor){};
 
 	// Final step, destroy the main thread since it is no longer needed
Index: src/libcfa/concurrency/kernel_private.h
===================================================================
--- src/libcfa/concurrency/kernel_private.h	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/kernel_private.h	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -31,5 +31,5 @@
 extern "C" {
 	void disable_interrupts();
-	void enable_interrupts_noRF();
+	void enable_interrupts_noPoll();
 	void enable_interrupts( DEBUG_CTX_PARAM );
 }
@@ -45,4 +45,5 @@
 thread_desc * nextThread(cluster * this);
 
+//Block current thread and release/wake-up the following resources
 void BlockInternal(void);
 void BlockInternal(spinlock * lock);
@@ -65,18 +66,15 @@
 void spin(processor * this, unsigned int * spin_count);
 
-struct system_proc_t {
-	processor proc;
-
+struct event_kernel_t {
 	alarm_list_t alarms;
-	spinlock alarm_lock;
-
-	bool pending_alarm;
+	spinlock lock;
 };
 
-extern cluster * systemCluster;
-extern system_proc_t * systemProcessor;
-extern volatile thread_local processor * this_processor;
-extern volatile thread_local coroutine_desc * this_coroutine;
-extern volatile thread_local thread_desc * this_thread;
+extern event_kernel_t * event_kernel;
+
+extern thread_local coroutine_desc * volatile this_coroutine;
+extern thread_local thread_desc *    volatile this_thread;
+extern thread_local processor *      volatile this_processor;
+
 extern volatile thread_local bool preemption_in_progress;
 extern volatile thread_local unsigned short disable_preempt_count;
@@ -91,4 +89,8 @@
 extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
 
+//-----------------------------------------------------------------------------
+// Utils
+#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
+
 #endif //KERNEL_PRIVATE_H
 
Index: src/libcfa/concurrency/preemption.c
===================================================================
--- src/libcfa/concurrency/preemption.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/preemption.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -34,24 +34,32 @@
 #endif
 
+//TODO move to defaults
 #define __CFA_DEFAULT_PREEMPTION__ 10000
 
+//TODO move to defaults
 __attribute__((weak)) unsigned int default_preemption() {
 	return __CFA_DEFAULT_PREEMPTION__;
 }
 
+// Short hands for signal context information
 #define __CFA_SIGCXT__ ucontext_t *
 #define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
 
+// FwdDeclarations : timeout handlers
 static void preempt( processor   * this );
 static void timeout( thread_desc * this );
 
+// FwdDeclarations : Signal handlers
 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
-void sigHandler_alarm    ( __CFA_SIGPARMS__ );
 void sigHandler_segv     ( __CFA_SIGPARMS__ );
 void sigHandler_abort    ( __CFA_SIGPARMS__ );
 
+// FwdDeclarations : sigaction wrapper
 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags );
-LIB_DEBUG_DO( bool validate( alarm_list_t * this ); )
-
+
+// FwdDeclarations : alarm thread main
+void * alarm_loop( __attribute__((unused)) void * args );
+
+// Machine specific register name
 #ifdef __x86_64__
 #define CFA_REG_IP REG_RIP
@@ -60,4 +68,12 @@
 #endif
 
+KERNEL_STORAGE(event_kernel_t, event_kernel);         // private storage for event kernel
+event_kernel_t * event_kernel;                        // kernel public handle to even kernel
+static pthread_t alarm_thread;                        // pthread handle to alarm thread
+
+void ?{}(event_kernel_t * this) {
+	(&this->alarms){};
+	(&this->lock){};
+}
 
 //=============================================================================================
@@ -65,13 +81,21 @@
 //=============================================================================================
 
+// Get next expired node
+static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_t currtime ) {
+	if( !alarms->head ) return NULL;                          // If no alarms return null
+	if( alarms->head->alarm >= currtime ) return NULL;        // If alarms head not expired return null
+	return pop(alarms);                                       // Otherwise just pop head
+}
+
+// Tick one frame of the Discrete Event Simulation for alarms
 void tick_preemption() {
-	alarm_list_t * alarms = &systemProcessor->alarms;
-	__cfa_time_t currtime = __kernel_get_time();
-
-	// LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ticking preemption @ %llu\n", currtime );
-	while( alarms->head && alarms->head->alarm < currtime ) {
-		alarm_node_t * node = pop(alarms);
-		// LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ticking %p\n", node );
-
+	alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
+	alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
+	__cfa_time_t currtime = __kernel_get_time();    // Check current time once so we everything "happens at once"
+
+	//Loop throught every thing expired
+	while( node = get_expired( alarms, currtime ) ) {
+
+		// Check if this is a kernel
 		if( node->kernel_alarm ) {
 			preempt( node->proc );
@@ -81,30 +105,22 @@
 		}
 
-		verify( validate( alarms ) );
-
+		// Check if this is a periodic alarm
 		__cfa_time_t period = node->period;
 		if( period > 0 ) {
-			node->alarm = currtime + period;
-			// LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Reinsert %p @ %llu (%llu + %llu)\n", node, node->alarm, currtime, period );
-			insert( alarms, node );
+			node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
+			insert( alarms, node );             // Reinsert the node for the next time it triggers
 		}
 		else {
-			node->set = false;
-		}
-	}
-
-	if( alarms->head ) {
-		__kernel_set_timer( alarms->head->alarm - currtime );
-	}
-
-	verify( validate( alarms ) );
-	// LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ticking preemption done\n" );
-}
-
+			node->set = false;                  // Node is one-shot, just mark it as not pending
+		}
+	}
+
+	// If there are still alarms pending, reset the timer
+	if( alarms->head ) { __kernel_set_timer( alarms->head->alarm - currtime ); }
+}
+
+// Update the preemption of a processor and notify interested parties
 void update_preemption( processor * this, __cfa_time_t duration ) {
-	LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p updating preemption to %llu\n", this, duration );
-
 	alarm_node_t * alarm = this->preemption_alarm;
-	duration *= 1000;
 
 	// Alarms need to be enabled
@@ -136,20 +152,20 @@
 
 extern "C" {
+	// Disable interrupts by incrementing the counter
 	void disable_interrupts() {
 		__attribute__((unused)) unsigned short new_val = __atomic_add_fetch_2( &disable_preempt_count, 1, __ATOMIC_SEQ_CST );
-		verify( new_val < (unsigned short)65_000 );
-		verify( new_val != (unsigned short) 0 );
-	}
-
-	void enable_interrupts_noRF() {
-		__attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
-		verify( prev != (unsigned short) 0 );
-	}
-
+		verify( new_val < 65_000u );              // If this triggers someone is disabling interrupts without enabling them
+	}
+
+	// Enable interrupts by decrementing the counter
+	// If counter reaches 0, execute any pending CtxSwitch
 	void enable_interrupts( DEBUG_CTX_PARAM ) {
-		processor * proc   = this_processor;
-		thread_desc * thrd = this_thread;
+		processor * proc   = this_processor;      // Cache the processor now since interrupts can start happening after the atomic add
+		thread_desc * thrd = this_thread;         // Cache the thread now since interrupts can start happening after the atomic add
+
 		unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
-		verify( prev != (unsigned short) 0 );
+		verify( prev != 0u );                     // If this triggers someone is enabled already enabled interruptsverify( prev != 0u );
+
+		// Check if we need to prempt the thread because an interrupt was missed
 		if( prev == 1 && proc->pending_preemption ) {
 			proc->pending_preemption = false;
@@ -157,8 +173,17 @@
 		}
 
+		// For debugging purposes : keep track of the last person to enable the interrupts
 		LIB_DEBUG_DO( proc->last_enable = caller; )
 	}
-}
-
+
+	// Disable interrupts by incrementint the counter
+	// Don't execute any pending CtxSwitch even if counter reaches 0
+	void enable_interrupts_noPoll() {
+		__attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
+		verify( prev != 0u );                     // If this triggers someone is enabled already enabled interrupts
+	}
+}
+
+// sigprocmask wrapper : unblock a single signal
 static inline void signal_unblock( int sig ) {
 	sigset_t mask;
@@ -171,4 +196,5 @@
 }
 
+// sigprocmask wrapper : block a single signal
 static inline void signal_block( int sig ) {
 	sigset_t mask;
@@ -181,36 +207,44 @@
 }
 
-static inline bool preemption_ready() {
-	return disable_preempt_count == 0 && !preemption_in_progress;
-}
-
-static inline void defer_ctxSwitch() {
-	this_processor->pending_preemption = true;
-}
-
-static inline void defer_alarm() {
-	systemProcessor->pending_alarm = true;
-}
-
+// kill wrapper : signal a processor
 static void preempt( processor * this ) {
 	pthread_kill( this->kernel_thread, SIGUSR1 );
 }
 
+// reserved for future use
 static void timeout( thread_desc * this ) {
 	//TODO : implement waking threads
 }
 
+
+// Check if a CtxSwitch signal handler shoud defer
+// If true  : preemption is safe
+// If false : preemption is unsafe and marked as pending
+static inline bool preemption_ready() {
+	bool ready = disable_preempt_count == 0 && !preemption_in_progress; // Check if preemption is safe
+	this_processor->pending_preemption = !ready;                        // Adjust the pending flag accordingly
+	return ready;
+}
+
 //=============================================================================================
 // Kernel Signal Startup/Shutdown logic
 //=============================================================================================
 
-static pthread_t alarm_thread;
-void * alarm_loop( __attribute__((unused)) void * args );
-
+// Startup routine to activate preemption
+// Called from kernel_startup
 void kernel_start_preemption() {
 	LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n");
-	__kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO );
-	// __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );
-	// __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );
+
+	// Start with preemption disabled until ready
+	disable_preempt_count = 1;
+
+	// Initialize the event kernel
+	event_kernel = (event_kernel_t *)&storage_event_kernel;
+	event_kernel{};
+
+	// Setup proper signal handlers
+	__kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO );         // CtxSwitch handler
+	// __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );      // Failure handler
+	// __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );      // Failure handler
 
 	signal_block( SIGALRM );
@@ -219,22 +253,34 @@
 }
 
+// Shutdown routine to deactivate preemption
+// Called from kernel_shutdown
 void kernel_stop_preemption() {
 	LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n");
 
+	// Block all signals since we are already shutting down
 	sigset_t mask;
 	sigfillset( &mask );
 	sigprocmask( SIG_BLOCK, &mask, NULL );
 
+	// Notify the alarm thread of the shutdown
 	sigval val = { 1 };
 	pthread_sigqueue( alarm_thread, SIGALRM, val );
+
+	// Wait for the preemption thread to finish
 	pthread_join( alarm_thread, NULL );
+
+	// Preemption is now fully stopped
+
 	LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n");
 }
 
+// Raii ctor/dtor for the preemption_scope
+// Used by thread to control when they want to receive preemption signals
 void ?{}( preemption_scope * this, processor * proc ) {
-	(&this->alarm){ proc };
+	(&this->alarm){ proc, zero_time, zero_time };
 	this->proc = proc;
 	this->proc->preemption_alarm = &this->alarm;
-	update_preemption( this->proc, this->proc->preemption );
+
+	update_preemption( this->proc, from_us(this->proc->cltr->preemption) );
 }
 
@@ -242,5 +288,5 @@
 	disable_interrupts();
 
-	update_preemption( this->proc, 0 );
+	update_preemption( this->proc, zero_time );
 }
 
@@ -249,19 +295,25 @@
 //=============================================================================================
 
+// Context switch signal handler
+// Receives SIGUSR1 signal and causes the current thread to yield
 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
 	LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
-	if( preemption_ready() ) {
-		preemption_in_progress = true;
-		signal_unblock( SIGUSR1 );
-		this_processor->pending_preemption = false;
-		preemption_in_progress = false;
-		BlockInternal( (thread_desc*)this_thread );
-	}
-	else {
-		defer_ctxSwitch();
-	}
-}
-
+
+	// Check if it is safe to preempt here
+	if( !preemption_ready() ) { return; }
+
+	preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
+	signal_unblock( SIGUSR1 );                          // We are about to CtxSwitch out of the signal handler, let other handlers in
+	preemption_in_progress = false;                     // Clear the in progress flag
+
+	// Preemption can occur here
+
+	BlockInternal( (thread_desc*)this_thread );         // Do the actual CtxSwitch
+}
+
+// Main of the alarm thread
+// Waits on SIGALRM and send SIGUSR1 to whom ever needs it
 void * alarm_loop( __attribute__((unused)) void * args ) {
+	// Block sigalrms to control when they arrive
 	sigset_t mask;
 	sigemptyset( &mask );
@@ -272,20 +324,30 @@
 	}
 
+	// Main loop
 	while( true ) {
+		// Wait for a sigalrm
 		siginfo_t info;
 		int sig = sigwaitinfo( &mask, &info );
+
+		// If another signal arrived something went wrong
 		assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
 
 		LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
+		// Switch on the code (a.k.a. the sender) to
 		switch( info.si_code )
 		{
+		// Timers can apparently be marked as sent for the kernel
+		// In either case, tick preemption
 		case SI_TIMER:
 		case SI_KERNEL:
 			LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
-			lock( &systemProcessor->alarm_lock DEBUG_CTX2 );
+			lock( &event_kernel->lock DEBUG_CTX2 );
 			tick_preemption();
-			unlock( &systemProcessor->alarm_lock );
+			unlock( &event_kernel->lock );
 			break;
+		// Signal was not sent by the kernel but by an other thread
 		case SI_QUEUE:
+			// For now, other thread only signal the alarm thread to shut it down
+			// If this needs to change use info.si_value and handle the case here
 			goto EXIT;
 		}
@@ -297,4 +359,5 @@
 }
 
+// Sigaction wrapper : register an signal handler
 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
 	struct sigaction act;
@@ -312,10 +375,9 @@
 }
 
-typedef void (*sa_handler_t)(int);
-
+// Sigaction wrapper : restore default handler
 static void __kernel_sigdefault( int sig ) {
 	struct sigaction act;
 
-	// act.sa_handler = SIG_DFL;
+	act.sa_handler = SIG_DFL;
 	act.sa_flags = 0;
 	sigemptyset( &act.sa_mask );
Index: src/libcfa/concurrency/thread
===================================================================
--- src/libcfa/concurrency/thread	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/thread	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -54,5 +54,5 @@
 }
 
-extern volatile thread_local thread_desc * this_thread;
+extern thread_local thread_desc * volatile this_thread;
 
 forall( dtype T | is_thread(T) )
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/libcfa/concurrency/thread.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -87,5 +87,5 @@
 
 void yield( void ) {
-	BlockInternal( (thread_desc *)this_thread );
+	BlockInternal( this_thread );
 }
 
Index: c/tests/.expect/concurrent/sched-int-barge.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-barge.txt	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ 	(revision )
@@ -1,100 +1,0 @@
-1000
-2000
-3000
-4000
-5000
-6000
-7000
-8000
-9000
-10000
-11000
-12000
-13000
-14000
-15000
-16000
-17000
-18000
-19000
-20000
-21000
-22000
-23000
-24000
-25000
-26000
-27000
-28000
-29000
-30000
-31000
-32000
-33000
-34000
-35000
-36000
-37000
-38000
-39000
-40000
-41000
-42000
-43000
-44000
-45000
-46000
-47000
-48000
-49000
-50000
-51000
-52000
-53000
-54000
-55000
-56000
-57000
-58000
-59000
-60000
-61000
-62000
-63000
-64000
-65000
-66000
-67000
-68000
-69000
-70000
-71000
-72000
-73000
-74000
-75000
-76000
-77000
-78000
-79000
-80000
-81000
-82000
-83000
-84000
-85000
-86000
-87000
-88000
-89000
-90000
-91000
-92000
-93000
-94000
-95000
-96000
-97000
-98000
-99000
-100000
Index: src/tests/preempt_longrun/Makefile.am
===================================================================
--- src/tests/preempt_longrun/Makefile.am	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/Makefile.am	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -25,5 +25,5 @@
 CC = @CFA_BINDIR@/@CFA_NAME@
 
-TESTS = barge block create disjoint enter enter3 processor stack wait yield
+TESTS = block create disjoint enter enter3 processor stack wait yield
 
 .INTERMEDIATE: ${TESTS}
Index: src/tests/preempt_longrun/Makefile.in
===================================================================
--- src/tests/preempt_longrun/Makefile.in	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/Makefile.in	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -453,5 +453,5 @@
 REPEAT = ${abs_top_srcdir}/tools/repeat -s
 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
-TESTS = barge block create disjoint enter enter3 processor stack wait yield
+TESTS = block create disjoint enter enter3 processor stack wait yield
 all: all-am
 
@@ -635,11 +635,4 @@
 	        TEST_LOGS="$$log_list"; \
 	exit $$?
-barge.log: barge
-	@p='barge'; \
-	b='barge'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 block.log: block
 	@p='block'; \
Index: c/tests/preempt_longrun/barge.c
===================================================================
--- src/tests/preempt_longrun/barge.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../sched-int-barge.c
Index: src/tests/preempt_longrun/create.c
===================================================================
--- src/tests/preempt_longrun/create.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/create.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -1,4 +1,6 @@
 #include <kernel>
 #include <thread>
+
+static const unsigned long N = 2_000ul;
 
 #ifndef PREEMPTION_RATE
@@ -16,5 +18,5 @@
 int main(int argc, char* argv[]) {
 	processor p;
-	for(int i = 0; i < 10_000ul; i++) {
+	for(int i = 0; i < N; i++) {
 		worker_t w[7];
 	}
Index: src/tests/preempt_longrun/enter.c
===================================================================
--- src/tests/preempt_longrun/enter.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/enter.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -3,5 +3,4 @@
 #include <thread>
 
-#undef N
 static const unsigned long N  = 70_000ul;
 
Index: src/tests/preempt_longrun/enter3.c
===================================================================
--- src/tests/preempt_longrun/enter3.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/enter3.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -3,5 +3,4 @@
 #include <thread>
 
-#undef N
 static const unsigned long N  = 50_000ul;
 
Index: src/tests/preempt_longrun/processor.c
===================================================================
--- src/tests/preempt_longrun/processor.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/processor.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -1,4 +1,6 @@
 #include <kernel>
 #include <thread>
+
+static const unsigned long N = 5_000ul;
 
 #ifndef PREEMPTION_RATE
@@ -15,5 +17,5 @@
 
 int main(int argc, char* argv[]) {
-	for(int i = 0; i < 10_000ul; i++) {
+	for(int i = 0; i < N; i++) {
 		processor p;
 	}
Index: src/tests/preempt_longrun/yield.c
===================================================================
--- src/tests/preempt_longrun/yield.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/preempt_longrun/yield.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -1,4 +1,6 @@
 #include <kernel>
 #include <thread>
+
+static const unsigned long N = 325_000ul;
 
 #ifndef PREEMPTION_RATE
@@ -13,5 +15,5 @@
 
 void main(worker_t * this) {
-	for(int i = 0; i < 325_000ul; i++) {
+	for(int i = 0; i < N; i++) {
 		yield();
 	}
Index: src/tests/sched-int-barge.c
===================================================================
--- src/tests/sched-int-barge.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/sched-int-barge.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -5,8 +5,13 @@
 #include <thread>
 
-#ifndef N
-#define N 100_000
+static const unsigned long N = 50_000ul;
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10_000ul
 #endif
 
+unsigned int default_preemption() {
+	return 0;
+}
 enum state_t { WAIT, SIGNAL, BARGE };
 
@@ -14,5 +19,5 @@
 
 monitor global_data_t {
-	bool done;
+	volatile bool done;
 	int counter;
 	state_t state;
@@ -55,5 +60,5 @@
 		c->do_wait2 = ((unsigned)rand48()) % (c->do_signal);
 
-		// if(c->do_wait1 == c->do_wait2) sout | "Same" | endl;
+		if(c->do_wait1 == c->do_wait2) sout | "Same" | endl;
 	}
 
@@ -93,9 +98,12 @@
 }
 
+static thread_desc * volatile the_threads;
+
 int main(int argc, char* argv[]) {
-	rand48seed(0);
-	processor p;
-	{
-		Threads t[17];
-	}
+        rand48seed(0);
+        processor p;
+        {
+                Threads t[17];
+                the_threads = (thread_desc*)t;
+        }
 }
Index: src/tests/sched-int-block.c
===================================================================
--- src/tests/sched-int-block.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/sched-int-block.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -5,7 +5,15 @@
 #include <thread>
 
-#ifndef N
-#define N 10_000
+#include <time.h>
+
+static const unsigned long N = 5_000ul;
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10_000ul
 #endif
+
+unsigned int default_preemption() {
+	return PREEMPTION_RATE;
+}
 
 enum state_t { WAITED, SIGNAL, BARGE };
@@ -101,5 +109,5 @@
 
 int main(int argc, char* argv[]) {
-	rand48seed(0);
+	rand48seed( time( NULL ) );
 	done = false;
 	processor p;
Index: src/tests/sched-int-disjoint.c
===================================================================
--- src/tests/sched-int-disjoint.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/sched-int-disjoint.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -4,7 +4,13 @@
 #include <thread>
 
-#ifndef N
-#define N 10_000
+static const unsigned long N = 10_000ul;
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10_000ul
 #endif
+
+unsigned int default_preemption() {
+	return PREEMPTION_RATE;
+}
 
 enum state_t { WAIT, SIGNAL, BARGE };
Index: src/tests/sched-int-wait.c
===================================================================
--- src/tests/sched-int-wait.c	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/sched-int-wait.c	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -5,7 +5,13 @@
 #include <thread>
 
-#ifndef N
-#define N 10_000
+static const unsigned long N = 10_000ul;
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10_000ul
 #endif
+
+unsigned int default_preemption() {
+	return PREEMPTION_RATE;
+}
 
 monitor global_t {};
@@ -114,5 +120,5 @@
 int main(int argc, char* argv[]) {
 	waiter_left = 4;
-	processor p;
+	processor p[2];
 	sout | "Starting" | endl;
 	{
Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision d49bfa8ec26d4120dc115e26fe83c7af90beb85b)
+++ src/tests/test.py	(revision 957453d26897927b799c1b03230f9629ffc92f9b)
@@ -221,9 +221,9 @@
 		if   retcode == TestResult.SUCCESS: 	result_txt = "Done"
 		elif retcode == TestResult.TIMEOUT: 	result_txt = "TIMEOUT"
-		else :						result_txt = "ERROR"
+		else :						result_txt = "ERROR code %d" % retcode
 	else :
 		if   retcode == TestResult.SUCCESS: 	result_txt = "PASSED"
 		elif retcode == TestResult.TIMEOUT: 	result_txt = "TIMEOUT"
-		else :						result_txt = "FAILED"
+		else :						result_txt = "FAILED with code %d" % retcode
 
 	#print result with error if needed
