Index: libcfa/src/concurrency/locks.cfa
===================================================================
--- libcfa/src/concurrency/locks.cfa	(revision 7efb322caf784371853c35ca8c931e520dd9a2ff)
+++ libcfa/src/concurrency/locks.cfa	(revision 302ef2aaddd091c9a6a4d293cbed9ee47deef00a)
@@ -1,10 +1,7 @@
 #include "locks.hfa"
 #include "kernel_private.hfa"
-#include <stdlib.h>
-#include <stdio.h>
 
 #include <kernel.hfa>
 #include <stdlib.hfa>
-#include <thread.hfa>
 
 ///////////////////////////////////////////////////////////////////
@@ -61,15 +58,15 @@
 void lock( blocking_lock & this ) with( this ) {
 	lock( lock __cfaabi_dbg_ctx2 );
-	if ( owner == active_thread() && !multi_acquisition) {
+	if ( owner == active_thread() && !multi_acquisition) { // single acquisition lock is held by current thread
 		abort("A single acquisition lock holder attempted to reacquire the lock resulting in a deadlock.");
-	} else if ( owner != 0p && owner != active_thread() ) {
+	} else if ( owner != 0p && owner != active_thread() ) {	// lock is held by some other thread
 		addTail( blocked_threads, *active_thread() );
 		wait_count++;
 		unlock( lock );
 		park( );
-	} else if ( owner == active_thread() && multi_acquisition ) {
+	} else if ( owner == active_thread() && multi_acquisition ) { // multi acquisition lock is held by current thread
 		recursion_count++;
 		unlock( lock );
-	} else {
+	} else { // lock isn't held
 		owner = active_thread();
 		recursion_count = 1;
@@ -81,9 +78,9 @@
 	bool ret = false;
 	lock( lock __cfaabi_dbg_ctx2 );
-	if ( owner == 0p ) {
+	if ( owner == 0p ) { // lock isn't held
 		owner = active_thread();
 		recursion_count = 1;
 		ret = true;
-	} else if ( owner == active_thread() && multi_acquisition ) {
+	} else if ( owner == active_thread() && multi_acquisition ) { // multi acquisition lock is held by current thread
 		recursion_count++;
 		ret = true;
@@ -94,5 +91,5 @@
 
 void unlock_error_check( blocking_lock & this ) with( this ) {
-	if ( owner == 0p ){ // no owner implies lock isn't held
+	if ( owner == 0p ){ // lock isn't held
 		abort( "There was an attempt to release a lock that isn't held" ); 
 	} else if ( strict_owner && owner != active_thread() ) {
@@ -113,5 +110,5 @@
 	unlock_error_check( this );
 	recursion_count--;
-	if ( recursion_count == 0 ) {
+	if ( recursion_count == 0 ) { // if recursion count is zero release lock and set new owner if one is waiting
 		pop_and_set_new_owner( this );
 	}
@@ -131,11 +128,11 @@
 }
 
-void add_( blocking_lock & this, $thread * t ) with( this ) {
+void on_notify( blocking_lock & this, $thread * t ) with( this ) {
     lock( lock __cfaabi_dbg_ctx2 );
-	if ( owner != 0p ) {
+	if ( owner != 0p ) { // lock held
 		addTail( blocked_threads, *t );
 		wait_count++;
 		unlock( lock );
-	} else {
+	} else {	// lock not held
 		owner = t;
 		recursion_count = 1;
@@ -145,5 +142,5 @@
 }
 
-void remove_( blocking_lock & this ) with( this ) {
+void on_wait( blocking_lock & this ) with( this ) {
     lock( lock __cfaabi_dbg_ctx2 );
 	unlock_error_check( this );
@@ -156,10 +153,10 @@
 ///////////////////////////////////////////////////////////////////
 
-// This is temporary until an inheritance bug is fixed
+// These routines are temporary until an inheritance bug is fixed
 
 void lock( single_acquisition_lock & this ){ lock( (blocking_lock &)this ); }
 void unlock( single_acquisition_lock & this ){ unlock( (blocking_lock &)this ); }
-void add_( single_acquisition_lock & this, struct $thread * t ){ add_( (blocking_lock &)this, t ); }
-void remove_( single_acquisition_lock & this ){ remove_( (blocking_lock &)this ); }
+void on_notify( single_acquisition_lock & this, struct $thread * t ){ on_notify( (blocking_lock &)this, t ); }
+void on_wait( single_acquisition_lock & this ){ on_wait( (blocking_lock &)this ); }
 void set_recursion_count( single_acquisition_lock & this, size_t recursion ){ set_recursion_count( (blocking_lock &)this, recursion ); }
 size_t get_recursion_count( single_acquisition_lock & this ){ return get_recursion_count( (blocking_lock &)this ); }
@@ -167,6 +164,6 @@
 void lock( owner_lock & this ){ lock( (blocking_lock &)this ); }
 void unlock( owner_lock & this ){ unlock( (blocking_lock &)this ); }
-void add_( owner_lock & this, struct $thread * t ){ add_( (blocking_lock &)this, t ); }
-void remove_( owner_lock & this ){ remove_( (blocking_lock &)this ); }
+void on_notify( owner_lock & this, struct $thread * t ){ on_notify( (blocking_lock &)this, t ); }
+void on_wait( owner_lock & this ){ on_wait( (blocking_lock &)this ); }
 void set_recursion_count( owner_lock & this, size_t recursion ){ set_recursion_count( (blocking_lock &)this, recursion ); }
 size_t get_recursion_count( owner_lock & this ){ return get_recursion_count( (blocking_lock &)this ); }
@@ -174,6 +171,6 @@
 void lock( multiple_acquisition_lock & this ){ lock( (blocking_lock &)this ); }
 void unlock( multiple_acquisition_lock & this ){ unlock( (blocking_lock &)this ); }
-void add_( multiple_acquisition_lock & this, struct $thread * t ){ add_( (blocking_lock &)this, t ); }
-void remove_( multiple_acquisition_lock & this ){ remove_( (blocking_lock &)this ); }
+void on_notify( multiple_acquisition_lock & this, struct $thread * t ){ on_notify( (blocking_lock &)this, t ); }
+void on_wait( multiple_acquisition_lock & this ){ on_wait( (blocking_lock &)this ); }
 void set_recursion_count( multiple_acquisition_lock & this, size_t recursion ){ set_recursion_count( (blocking_lock &)this, recursion ); }
 size_t get_recursion_count( multiple_acquisition_lock & this ){ return get_recursion_count( (blocking_lock &)this ); }
@@ -188,13 +185,16 @@
     	// This condition_variable member is called from the kernel, and therefore, cannot block, but it can spin.
 	    lock( cond->lock __cfaabi_dbg_ctx2 );
-	    if ( listed(i) ) {			// is thread on queue
+
+	    // this check is necessary to avoid a race condition since this timeout handler 
+	    // 	may still be called after a thread has been removed from the queue but 
+	    // 	before the alarm is unregistered
+	    if ( listed(i) ) {							// is thread on queue
 	    	i->signalled = false;
-	    	cond->last_thread = i;		// REMOVE THIS AFTER DEBUG
-			remove( cond->blocked_threads, *i );		 //remove this thread O(1)
+			remove( cond->blocked_threads, *i );	// remove this thread O(1)
 			cond->count--;
-			if( !i->lock ) {
-				unpark( i->t );
+			if( i->lock ) {
+				on_notify(*i->lock, i->t);			// call lock's on_notify if a lock was passed
 	    	} else {
-	    		add_(*i->lock, i->t);			// call lock's add_
+	    		unpark( i->t );						// otherwise wake thread
 	    	}
 	    }
@@ -202,4 +202,5 @@
 	}
 
+	// this casts the alarm node to our wrapped type since we used type erasure
 	void alarm_node_wrap_cast( alarm_node_t & a ) { timeout_handler( (alarm_node_wrap(L) &)a ); }
 
@@ -208,5 +209,4 @@
 		this.blocked_threads{};
 		this.count = 0;
-		this.last_thread = 0p; // REMOVE AFTER DEBUG
 	}
 
@@ -224,7 +224,7 @@
 			count--;
 			if (popped.lock) {
-				add_(*popped.lock, popped.t);
+				on_notify(*popped.lock, popped.t); // if lock passed call on_notify
 			} else {
-				unpark(popped.t);
+				unpark(popped.t); // otherwise wake thread
 			}
 		}
@@ -258,10 +258,10 @@
 
 	size_t queue_and_get_recursion( condition_variable(L) & this, info_thread(L) * i ) with(this) {
-		addTail( blocked_threads, *i );
+		addTail( blocked_threads, *i ); // add info_thread to waiting queue
 		count++;
 		size_t recursion_count = 0;
-		if (i->lock) {
+		if (i->lock) { // if lock was passed get recursion count to reset to after waking thread
 			recursion_count = get_recursion_count(*i->lock);
-			remove_( *i->lock );
+			on_wait( *i->lock );
 		}
 		return recursion_count;
@@ -287,6 +287,6 @@
 		unlock( lock );
 		park();
-		unregister_self( &node_wrap.alarm_node );
-		if (info.lock) set_recursion_count(*info.lock, recursion_count);
+		unregister_self( &node_wrap.alarm_node ); // unregisters alarm so it doesn't go off if this happens first
+		if (info.lock) set_recursion_count(*info.lock, recursion_count); // resets recursion count here after waking
 	}
 
Index: libcfa/src/concurrency/locks.hfa
===================================================================
--- libcfa/src/concurrency/locks.hfa	(revision 7efb322caf784371853c35ca8c931e520dd9a2ff)
+++ libcfa/src/concurrency/locks.hfa	(revision 302ef2aaddd091c9a6a4d293cbed9ee47deef00a)
@@ -6,5 +6,4 @@
 #include "bits/locks.hfa"
 #include "bits/sequence.hfa"
-#include "bits/containers.hfa"
 
 #include "invoke.h"
@@ -20,8 +19,8 @@
 
 trait is_blocking_lock(dtype L | sized(L)) {
-	void add_( L &, struct $thread * );		// For synchronization locks to use when acquiring
-	void remove_( L & );    // For synchronization locks to use when releasing
-	size_t get_recursion_count( L & ); // to get recursion count for cond lock to reset after waking
-	void set_recursion_count( L &, size_t recursion ); // to set recursion count after getting signalled;
+	void on_notify( L &, struct $thread * );			// For synchronization locks to use when acquiring
+	void on_wait( L & );    							// For synchronization locks to use when releasing
+	size_t get_recursion_count( L & ); 					// to get recursion count for cond lock to reset after waking
+	void set_recursion_count( L &, size_t recursion );	// to set recursion count after getting signalled;
 };
 
@@ -30,10 +29,12 @@
 ///////////////////////////////////////////////////////////////////
 
+// the info thread is a wrapper around a thread used
+// to store extra data for use in the condition variable
 forall(dtype L | is_blocking_lock(L)) {
 	struct info_thread {
-		inline Seqable;
-		struct $thread * t;
-		uintptr_t info;
-		L * lock;
+		inline Seqable;					// used to put info_thread on a dl queue (aka sequence)
+		struct $thread * t;				// waiting thread
+		uintptr_t info;					// shadow field
+		L * lock;						// lock that is passed to wait() (if one is passed)
 		bool signalled;					// true when signalled and false when timeout wakes thread
 	};
@@ -44,4 +45,5 @@
 	void ^?{}( info_thread(L) & this );
 
+	// for use by sequence
 	info_thread(L) *& Back( info_thread(L) * this );
 	info_thread(L) *& Next( info_thread(L) * this );
@@ -102,6 +104,6 @@
 bool try_lock( blocking_lock & this );
 void unlock( blocking_lock & this );
-void add_( blocking_lock & this, struct $thread * t );
-void remove_( blocking_lock & this );
+void on_notify( blocking_lock & this, struct $thread * t );
+void on_wait( blocking_lock & this );
 size_t wait_count( blocking_lock & this );
 void set_recursion_count( blocking_lock & this, size_t recursion );
@@ -110,6 +112,6 @@
 void lock( single_acquisition_lock & this );
 void unlock( single_acquisition_lock & this );
-void add_( single_acquisition_lock & this, struct $thread * t );
-void remove_( single_acquisition_lock & this );
+void on_notify( single_acquisition_lock & this, struct $thread * t );
+void on_wait( single_acquisition_lock & this );
 void set_recursion_count( single_acquisition_lock & this, size_t recursion );
 size_t get_recursion_count( single_acquisition_lock & this );
@@ -117,6 +119,6 @@
 void lock( owner_lock & this );
 void unlock( owner_lock & this );
-void add_( owner_lock & this, struct $thread * t );
-void remove_( owner_lock & this );
+void on_notify( owner_lock & this, struct $thread * t );
+void on_wait( owner_lock & this );
 void set_recursion_count( owner_lock & this, size_t recursion );
 size_t get_recursion_count( owner_lock & this );
@@ -124,6 +126,6 @@
 void lock( multiple_acquisition_lock & this );
 void unlock( multiple_acquisition_lock & this );
-void add_( multiple_acquisition_lock & this, struct $thread * t );
-void remove_( multiple_acquisition_lock & this );
+void on_notify( multiple_acquisition_lock & this, struct $thread * t );
+void on_wait( multiple_acquisition_lock & this );
 void set_recursion_count( multiple_acquisition_lock & this, size_t recursion );
 size_t get_recursion_count( multiple_acquisition_lock & this );
@@ -136,6 +138,4 @@
 		// Spin lock used for mutual exclusion
 		__spinlock_t lock;
-
-		info_thread(L) * last_thread;
 
 		// List of blocked threads
