Index: src/examples/thread.c
===================================================================
--- src/examples/thread.c	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#include <fstream>
-#include <kernel>
-#include <stdlib>
-#include <threads>
-
-// Start coroutine routines
-struct MyThread {
-	thread t;
-	unsigned id;
-	unsigned count;
-};
-
-DECL_THREAD(MyThread)
-
-void ?{}( MyThread * this ) {
-}
-
-void ?{}( MyThread * this, unsigned id, unsigned count ) {
-	this->id = id;
-	this->count = count;
-}
-
-void main(MyThread* this) {
-	sout | "Thread" | this->id | " : Suspending" | this->count | "times" | endl;
-	yield();
-
-	for(int i = 0; i < this->count; i++) {
-		sout | "Thread" | this->id | " : Suspend No." | i + 1 | endl;
-		yield();
-	}
-}
-
-int main(int argc, char* argv[]) {
-
-	unsigned itterations = 10u;
-	if(argc == 2) { 
-		int val = ato(argv[1]);
-		assert(val >= 0);
-		itterations = val;
-	}
-
-	sout | "User main begin" | endl;
-
-	{
-		processor p;
-		{
-			scoped(MyThread) thread1 = { 1u, itterations };
-			scoped(MyThread) thread2 = { 2u, itterations };
-		}
-	}
-
-	sout | "User main end" | endl;
-
-	return 0;
-}
Index: src/libcfa/concurrency/coroutines
===================================================================
--- src/libcfa/concurrency/coroutines	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/coroutines	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -65,5 +65,5 @@
 
 // Private wrappers for context switch and stack creation
-extern void corCxtSw(coroutine * src, coroutine * dst);
+extern void CoroutineCtxSwitch(coroutine * src, coroutine * dst);
 extern void create_stack( coStack_t * this, unsigned int storageSize );
 
@@ -81,5 +81,5 @@
 		src->name, src, src->last->name, src->last );
 
-	corCxtSw( src, src->last );
+	CoroutineCtxSwitch( src, src->last );
 }
 
@@ -107,5 +107,5 @@
 
       // always done for performance testing
-	corCxtSw( src, dst );
+	CoroutineCtxSwitch( src, dst );
 }
 
Index: src/libcfa/concurrency/coroutines.c
===================================================================
--- src/libcfa/concurrency/coroutines.c	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/coroutines.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -98,11 +98,6 @@
 }
 
-// We need to call suspend from invoke.c, so we expose this wrapper that
-// is not inline (We can't inline Cforall in C)
-void suspend_no_inline(void) {
-	suspend();
-}
-
-void corCxtSw(coroutine* src, coroutine* dst) {
+// Wrapper for co
+void CoroutineCtxSwitch(coroutine* src, coroutine* dst) {
 	// THREAD_GETMEM( This )->disableInterrupts();
 
@@ -167,4 +162,12 @@
 }
 
+// We need to call suspend from invoke.c, so we expose this wrapper that
+// is not inline (We can't inline Cforall in C)
+extern "C" {
+	void __suspend_internal(void) {
+		suspend();
+	}
+}
+
 // Local Variables: //
 // mode: c //
Index: src/libcfa/concurrency/invoke.c
===================================================================
--- src/libcfa/concurrency/invoke.c	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/invoke.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -28,6 +28,6 @@
 // Called from the kernel when starting a coroutine or task so must switch back to user mode.
 
-extern void __suspend_no_inline__F___1(void);
-extern void __signal_termination__F_P7sthread__1(struct thread*);
+extern void __suspend_internal(void);
+extern void __thread_signal_termination(struct thread*);
 
 void CtxInvokeCoroutine(
@@ -41,5 +41,5 @@
 
       if(cor->state == Primed) {
-            __suspend_no_inline__F___1();
+            __suspend_internal();
       }
 
@@ -52,6 +52,6 @@
 
       //Final suspend, should never return
-      __suspend_no_inline__F___1();
-      assertf(false, "Resumed dead coroutine");
+      __suspend_internal();
+      abortf("Resumed dead coroutine");
 }
 
@@ -61,7 +61,5 @@
       void *this
 ) {
-      // LIB_DEBUG_PRINTF("Invoke Thread : Received %p (main %p, get_t %p)\n", this, main, get_thread);
-
-      __suspend_no_inline__F___1();
+      __suspend_internal();
 
       struct thread* thrd = get_thread( this );
@@ -72,9 +70,9 @@
       main( this );
 
-      __signal_termination__F_P7sthread__1(thrd);
+      __thread_signal_termination(thrd);
 
       //Final suspend, should never return
-      __suspend_no_inline__F___1();
-      assertf(false, "Resumed dead thread");
+      __suspend_internal();
+      abortf("Resumed dead thread");
 }
 
Index: src/libcfa/concurrency/kernel.c
===================================================================
--- src/libcfa/concurrency/kernel.c	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/kernel.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -15,4 +15,8 @@
 //
 
+//Start and stop routine for the kernel, declared first to make sure they run first
+void kernel_startup(void)  __attribute__((constructor(101)));
+void kernel_shutdown(void) __attribute__((destructor(101)));
+
 //Header
 #include "kernel"
@@ -52,7 +56,4 @@
 processor * systemProcessor;
 thread * mainThread;
-
-void kernel_startup(void)  __attribute__((constructor(101)));
-void kernel_shutdown(void) __attribute__((destructor(101)));
 
 //-----------------------------------------------------------------------------
@@ -184,5 +185,5 @@
 void main(processorCtx_t * ctx);
 thread * nextThread(cluster * this);
-void runThread(processor * this, thread * dst);
+void scheduleInternal(processor * this, thread * dst);
 void spin(processor * this, unsigned int * spin_count);
 
@@ -197,5 +198,5 @@
 
 		if(readyThread) {
-			runThread(this, readyThread);
+			scheduleInternal(this, readyThread);
 			spin_count = 0;
 		} else {
@@ -209,25 +210,45 @@
 }
 
-void runThread(processor * this, thread * dst) {
+//Declarations for scheduleInternal
+extern void ThreadCtxSwitch(coroutine * src, coroutine * dst);
+
+// scheduleInternal runs a thread by context switching 
+// from the processor coroutine to the target thread 
+void scheduleInternal(processor * this, thread * dst) {
+	// coroutine * proc_ctx = get_coroutine(this->ctx);
+	// coroutine * thrd_ctx = get_coroutine(dst);
+
+	// //Update global state
+	// this->current_thread = dst;
+
+	// // Context Switch to the thread
+	// ThreadCtxSwitch(proc_ctx, thrd_ctx);
+	// // when ThreadCtxSwitch returns we are back in the processor coroutine
+
 	coroutine * proc_ctx = get_coroutine(this->ctx);
 	coroutine * thrd_ctx = get_coroutine(dst);
-	thrd_ctx->last = proc_ctx;
-
-	// context switch to specified coroutine
-	// Which is now the current_coroutine
-	// LIB_DEBUG_PRINTF("Kernel : switching to ctx %p (from %p, current %p)\n", thrd_ctx, proc_ctx, current_coroutine);
-	this->current_thread = dst;
-	this->current_coroutine = thrd_ctx;
-	CtxSwitch( proc_ctx->stack.context, thrd_ctx->stack.context );
-	this->current_coroutine = proc_ctx;
-	// LIB_DEBUG_PRINTF("Kernel : returned from ctx %p (to %p, current %p)\n", thrd_ctx, proc_ctx, current_coroutine);
-
-	// when CtxSwitch returns we are back in the processor coroutine
-}
-
+      thrd_ctx->last = proc_ctx;
+ 
+      // context switch to specified coroutine
+      // Which is now the current_coroutine
+      LIB_DEBUG_PRINTF("Kernel : switching to ctx %p (from %p, current %p)\n", thrd_ctx, proc_ctx, this->current_coroutine);
+      this->current_thread = dst;
+      this->current_coroutine = thrd_ctx;
+      CtxSwitch( proc_ctx->stack.context, thrd_ctx->stack.context );
+      this->current_coroutine = proc_ctx;
+      LIB_DEBUG_PRINTF("Kernel : returned from ctx %p (to %p, current %p)\n", thrd_ctx, proc_ctx, this->current_coroutine);
+ 
+      // when CtxSwitch returns we are back in the processor coroutine
+}
+
+// Handles spinning logic
+// TODO : find some strategy to put cores to sleep after some time
 void spin(processor * this, unsigned int * spin_count) {
 	(*spin_count)++;
 }
 
+// Context invoker for processors
+// This is the entry point for processors (kernel threads)
+// It effectively constructs a coroutine by stealing the pthread stack
 void * CtxInvokeProcessor(void * arg) {
 	processor * proc = (processor *) arg;
@@ -241,17 +262,10 @@
 	processorCtx_t proc_cor_storage = { proc, &info };
 
+	//Set global state
 	proc->current_coroutine = &proc->ctx->c;
 	proc->current_thread = NULL;
 
+	//We now have a proper context from which to schedule threads
 	LIB_DEBUG_PRINTF("Kernel : core %p created (%p)\n", proc, proc->ctx);
-
-	// LIB_DEBUG_PRINTF("Kernel : core    base : %p \n", info.base );
-	// LIB_DEBUG_PRINTF("Kernel : core storage : %p \n", info.storage );
-	// LIB_DEBUG_PRINTF("Kernel : core    size : %x \n", info.size );
-	// LIB_DEBUG_PRINTF("Kernel : core   limit : %p \n", info.limit );
-	// LIB_DEBUG_PRINTF("Kernel : core context : %p \n", info.context );
-	// LIB_DEBUG_PRINTF("Kernel : core     top : %p \n", info.top );
-
-	//We now have a proper context from which to schedule threads
 
 	// SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't 
@@ -264,4 +278,5 @@
       proc_cor_storage.c.notHalted = false;
 
+	// Main routine of the core returned, the core is now fully terminated
 	LIB_DEBUG_PRINTF("Kernel : core %p main ended (%p)\n", proc, proc->ctx);	
 
Index: src/libcfa/concurrency/threads
===================================================================
--- src/libcfa/concurrency/threads	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/threads	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -27,12 +27,12 @@
 // Anything that implements this trait can be resumed.
 // Anything that is resumed is a coroutine.
-trait is_thread(dtype T | sized(T)) {
+trait is_thread(dtype T) {
       void main(T* this);
       thread* get_thread(T* this);
 };
 
-#define DECL_THREAD(X) static inline thread* get_thread(X* this) { return &this->t; } void main(X* this);
+#define DECL_THREAD(X) thread* get_thread(X* this) { return &this->t; } void main(X* this);
 
-forall( dtype T | sized(T) | is_thread(T) )
+forall( dtype T | is_thread(T) )
 static inline coroutine* get_coroutine(T* this) {
 	return &get_thread(this)->c;
Index: src/libcfa/concurrency/threads.c
===================================================================
--- src/libcfa/concurrency/threads.c	(revision 0157ca7bcce204f62e0267dbebe739efb705eca2)
+++ src/libcfa/concurrency/threads.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -31,8 +31,8 @@
 //-----------------------------------------------------------------------------
 // Forward declarations
-forall( dtype T | sized(T) | is_thread(T) )
+forall( dtype T | is_thread(T) )
 void start( T* this );
 
-forall( dtype T | sized(T) | is_thread(T) )
+forall( dtype T | is_thread(T) )
 void stop( T* this );
 
@@ -78,5 +78,5 @@
 extern void thread_schedule( thread * );
 
-forall( dtype T | sized(T) | is_thread(T) )
+forall( dtype T | is_thread(T) )
 void start( T* this ) {
 	coroutine* thrd_c = get_coroutine(this);
@@ -85,5 +85,5 @@
 	get_this_processor()->current_coroutine = thrd_c;
 
-	// LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", handle, thrd_c, thrd_h);
+	LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
 
 	create_stack(&thrd_c->stack, thrd_c->stack.size);
@@ -91,8 +91,10 @@
 	CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
 
+	LIB_DEBUG_PRINTF("Thread started : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
+
 	thread_schedule(thrd_h);
 }
 
-forall( dtype T | sized(T) | is_thread(T) )
+forall( dtype T | is_thread(T) )
 void stop( T* this ) {
 	thread*  thrd = get_thread(this);
@@ -102,13 +104,34 @@
 }
 
-void signal_termination( thread * this ) {
-	this->c.state = Halt;
-      this->c.notHalted = false;
-	unlock( &this->lock );
-}
-
 void yield( void ) {
 	thread_schedule( this_thread() );
 	suspend();
+}
+
+void ThreadCtxSwitch(coroutine* src, coroutine* dst) {
+	dst->last = src;
+
+	// set state of current coroutine to inactive
+	src->state = Inactive;
+
+	// set new coroutine that task is executing
+	get_this_processor()->current_coroutine = dst;	
+
+	// context switch to specified coroutine
+	CtxSwitch( src->stack.context, dst->stack.context );
+	// when CtxSwitch returns we are back in the src coroutine
+
+	// set state of new coroutine to active
+	src->state = Active;
+}
+
+// C Helper to signal the termination of a thread
+// Used in invoke.c
+extern "C" {
+	void __thread_signal_termination( thread * this ) {
+		this->c.state = Halt;
+		this->c.notHalted = false;
+		unlock( &this->lock );
+	}
 }
 
Index: src/tests/.expect/thread.txt
===================================================================
--- src/tests/.expect/thread.txt	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
+++ src/tests/.expect/thread.txt	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -0,0 +1,22 @@
+User main begin
+First : Suspend No. 1
+First : Suspend No. 2
+First : Suspend No. 3
+First : Suspend No. 4
+First : Suspend No. 5
+First : Suspend No. 6
+First : Suspend No. 7
+First : Suspend No. 8
+First : Suspend No. 9
+First : Suspend No. 10
+Second : Suspend No. 1
+Second : Suspend No. 2
+Second : Suspend No. 3
+Second : Suspend No. 4
+Second : Suspend No. 5
+Second : Suspend No. 6
+Second : Suspend No. 7
+Second : Suspend No. 8
+Second : Suspend No. 9
+Second : Suspend No. 10
+User main end
Index: src/tests/thread.c
===================================================================
--- src/tests/thread.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
+++ src/tests/thread.c	(revision 0c92c9f0632273f81f11622ea9a570797b9c7092)
@@ -0,0 +1,43 @@
+#include <fstream>
+#include <kernel>
+#include <stdlib>
+#include <threads>
+
+struct First { thread t; simple_lock* lock; };
+struct Second { thread t; simple_lock* lock; };
+
+DECL_THREAD(First)
+DECL_THREAD(Second)
+
+void ?{}( First * this, simple_lock* lock ) { this->lock = lock; }
+void ?{}( Second * this, simple_lock* lock ) { this->lock = lock; }
+
+void main(First* this) {
+	for(int i = 0; i < 10; i++) {
+		sout | "First : Suspend No." | i + 1 | endl;
+		yield();
+	}
+	unlock(this->lock);
+}
+
+void main(Second* this) {
+	lock(this->lock);	
+	for(int i = 0; i < 10; i++) {
+		sout | "Second : Suspend No." | i + 1 | endl;
+		yield();
+	}
+}
+
+
+int main(int argc, char* argv[]) {
+	simple_lock lock;
+	sout | "User main begin" | endl;
+	{
+		// processor p;
+		{
+			scoped(First)  f = { &lock };
+			scoped(Second) s = { &lock };
+		}
+	}
+	sout | "User main end" | endl;
+}
