Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/Makefile.am	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -53,5 +53,5 @@
 
 thread_headers = concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa \
-		concurrency/monitor.hfa concurrency/mutex.hfa
+		concurrency/monitor.hfa concurrency/mutex.hfa concurrency/exception.hfa
 
 thread_libsrc = concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/coroutine.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -215,8 +215,4 @@
 		return cor;
 	}
-
-	struct $coroutine * __cfactx_cor_active(void) {
-		return active_coroutine();
-	}
 }
 
Index: libcfa/src/concurrency/exception.cfa
===================================================================
--- libcfa/src/concurrency/exception.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
+++ libcfa/src/concurrency/exception.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -0,0 +1,91 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// exception.cfa -- Exceptions in a concurrent environment.
+//
+// Author           : Andrew Beach
+// Created On       : Mon Aug 17 10:41:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Tue Aug 25 14:41:00 2020
+// Update Count     : 0
+//
+
+extern "C" {
+// use this define to make unwind.h play nice, definitely a hack
+#define HIDE_EXPORTS
+#include <unwind.h>
+#undef HIDE_EXPORTS
+}
+
+#include "invoke.h"
+#include "exception.hfa"
+#include "coroutine.hfa"
+
+extern struct $thread * mainThread;
+
+// Common pattern for all the stop functions, wait until the end then act.
+#define STOP_AT_END_FUNCTION(NAME, ...) \
+static _Unwind_Reason_Code NAME( \
+		int version, \
+		_Unwind_Action actions, \
+		_Unwind_Exception_Class exception_class, \
+		struct _Unwind_Exception * unwind_exception, \
+		struct _Unwind_Context * unwind_context, \
+		void * stop_param) { \
+	verify(actions & _UA_CLEANUP_PHASE); \
+	verify(actions & _UA_FORCE_UNWIND); \
+	verify(!(actions & _UA_SEARCH_PHASE)); \
+	verify(!(actions & _UA_HANDLER_FRAME)); \
+	if ( actions & _UA_END_OF_STACK ) { \
+		__VA_ARGS__ \
+	} else { \
+		return _URC_NO_REASON; \
+	} \
+}
+
+STOP_AT_END_FUNCTION(main_cancelstop,
+	abort();
+)
+
+STOP_AT_END_FUNCTION(thread_cancelstop,
+	// TODO: Instead pass information to the joiner.
+	abort();
+)
+
+STOP_AT_END_FUNCTION(coroutine_cancelstop,
+	// TODO: Instead pass information to the last resumer.
+	abort();
+)
+
+extern "C" {
+
+struct exception_context_t * this_exception_context(void) {
+	return &__get_stack( active_coroutine() )->exception_context;
+}
+
+_Unwind_Reason_Code __cfaehm_cancellation_unwind( struct _Unwind_Exception * unwind_exception ) {
+	_Unwind_Stop_Fn stop_func;
+	void * stop_param;
+
+	struct $thread * this_thread = TL_GET( this_thread );
+	if ( &this_thread->self_cor != this_thread->curr_cor ) {
+		struct $coroutine * cor = this_thread->curr_cor;
+		cor->cancellation = unwind_exception;
+
+		stop_func = coroutine_cancelstop;
+		stop_param = cor;
+	} else if ( mainThread == this_thread ) {
+		stop_func = main_cancelstop;
+		stop_param = (void *)0x22;
+	} else {
+		stop_func = thread_cancelstop;
+		stop_param = this_thread;
+	}
+
+	return _Unwind_ForcedUnwind( unwind_exception, stop_func, stop_param );
+}
+
+}
Index: libcfa/src/concurrency/exception.hfa
===================================================================
--- libcfa/src/concurrency/exception.hfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
+++ libcfa/src/concurrency/exception.hfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -0,0 +1,35 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// exception.hfa -- Exceptions in a concurrent environment.
+//
+// Author           : Andrew Beach
+// Created On       : Mon Aug 24 10:41:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Mon Aug 24 14:27:00 2020
+// Update Count     : 0
+//
+
+#pragma once
+
+#include "bits/defs.hfa"
+#include "invoke.h"
+struct _Unwind_Exception;
+
+// It must also be usable as a C header file.
+
+#ifdef __cforall
+extern "C" {
+#endif
+
+struct exception_context_t * this_exception_context(void) OPTIONAL_THREAD;
+
+_Unwind_Reason_Code __cfaehm_cancellation_unwind(
+		struct _Unwind_Exception * unwind_exception ) OPTIONAL_THREAD;
+
+#ifdef __cforall
+}
+#endif
Index: libcfa/src/concurrency/invoke.c
===================================================================
--- libcfa/src/concurrency/invoke.c	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/invoke.c	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -29,5 +29,4 @@
 // Called from the kernel when starting a coroutine or task so must switch back to user mode.
 
-extern struct $coroutine * __cfactx_cor_active(void);
 extern struct $coroutine * __cfactx_cor_finish(void);
 extern void __cfactx_cor_leave ( struct $coroutine * );
@@ -36,8 +35,4 @@
 extern void disable_interrupts() OPTIONAL_THREAD;
 extern void enable_interrupts( __cfaabi_dbg_ctx_param );
-
-struct exception_context_t * this_exception_context() {
-	return &__get_stack( __cfactx_cor_active() )->exception_context;
-}
 
 void __cfactx_invoke_coroutine(
Index: libcfa/src/concurrency/invoke.h
===================================================================
--- libcfa/src/concurrency/invoke.h	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/invoke.h	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -98,6 +98,4 @@
 	}
 
-	struct exception_context_t * this_exception_context();
-
 	// struct which calls the monitor is accepting
 	struct __waitfor_mask_t {
Index: libcfa/src/concurrency/io/setup.cfa
===================================================================
--- libcfa/src/concurrency/io/setup.cfa	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/io/setup.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -384,5 +384,5 @@
 			/* paranoid */ verify( is_pow2( params_in.num_ready ) || (params_in.num_ready < 8) );
 			sq.ready_cnt = max( params_in.num_ready, 8 );
-			sq.ready = alloc_align( 64, sq.ready_cnt );
+			sq.ready = alloc( sq.ready_cnt, 64`align );
 			for(i; sq.ready_cnt) {
 				sq.ready[i] = -1ul32;
Index: libcfa/src/concurrency/kernel/startup.cfa
===================================================================
--- libcfa/src/concurrency/kernel/startup.cfa	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/kernel/startup.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -579,4 +579,5 @@
 
 	// Lock the RWlock so no-one pushes/pops while we are changing the queue
+	disable_interrupts();
 	uint_fast32_t last_size = ready_mutate_lock();
 
@@ -586,4 +587,6 @@
 	// Unlock the RWlock
 	ready_mutate_unlock( last_size );
+	enable_interrupts_noPoll(); // Don't poll, could be in main cluster
+
 
 	this.io.cnt  = num_io;
@@ -601,4 +604,5 @@
 
 	// Lock the RWlock so no-one pushes/pops while we are changing the queue
+	disable_interrupts();
 	uint_fast32_t last_size = ready_mutate_lock();
 
@@ -608,4 +612,5 @@
 	// Unlock the RWlock
 	ready_mutate_unlock( last_size );
+	enable_interrupts_noPoll(); // Don't poll, could be in main cluster
 
 	#if !defined(__CFA_NO_STATISTICS__)
Index: libcfa/src/concurrency/ready_queue.cfa
===================================================================
--- libcfa/src/concurrency/ready_queue.cfa	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/concurrency/ready_queue.cfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -215,4 +215,29 @@
 }
 
+static inline [unsigned, bool] idx_from_r(unsigned r, unsigned preferred) {
+	unsigned i;
+	bool local;
+	#if defined(BIAS)
+		unsigned rlow  = r % BIAS;
+		unsigned rhigh = r / BIAS;
+		if((0 != rlow) && preferred >= 0) {
+			// (BIAS - 1) out of BIAS chances
+			// Use perferred queues
+			i = preferred + (rhigh % 4);
+			local = true;
+		}
+		else {
+			// 1 out of BIAS chances
+			// Use all queues
+			i = rhigh;
+			local = false;
+		}
+	#else
+		i = r;
+		local = false;
+	#endif
+	return [i, local];
+}
+
 //-----------------------------------------------------------------------
 __attribute__((hot)) bool push(struct cluster * cltr, struct $thread * thrd) with (cltr->ready_queue) {
@@ -222,7 +247,8 @@
 	thrd->link.ts = rdtscl();
 
-	#if defined(BIAS) && !defined(__CFA_NO_STATISTICS__)
-		bool local = false;
-		int preferred =
+	__attribute__((unused)) bool local;
+	__attribute__((unused)) int preferred;
+	#if defined(BIAS)
+		preferred =
 			//*
 			kernelTLS.this_processor ? kernelTLS.this_processor->id * 4 : -1;
@@ -230,6 +256,4 @@
 			thrd->link.preferred * 4;
 			//*/
-
-
 	#endif
 
@@ -238,26 +262,12 @@
 	do {
 		// Pick the index of a lane
-		#if defined(BIAS)
-			unsigned r = __tls_rand();
-			unsigned rlow  = r % BIAS;
-			unsigned rhigh = r / BIAS;
-			if((0 != rlow) && preferred >= 0) {
-				// (BIAS - 1) out of BIAS chances
-				// Use perferred queues
-				i = preferred + (rhigh % 4);
-
-				#if !defined(__CFA_NO_STATISTICS__)
-					local = true;
-					__tls_stats()->ready.pick.push.local++;
-				#endif
-			}
-			else {
-				// 1 out of BIAS chances
-				// Use all queues
-				i = rhigh;
-				local = false;
-			}
-		#else
-			i = __tls_rand();
+		// unsigned r = __tls_rand();
+		unsigned r = __tls_rand_fwd();
+		[i, local] = idx_from_r(r, preferred);
+
+		#if !defined(__CFA_NO_STATISTICS__)
+			if(local) {
+				__tls_stats()->ready.pick.push.local++;
+			}
 		#endif
 
@@ -274,5 +284,9 @@
 
 	// Actually push it
-	bool lane_first = push(lanes.data[i], thrd);
+	#ifdef USE_SNZI
+		bool lane_first =
+	#endif
+
+	push(lanes.data[i], thrd);
 
 	#ifdef USE_SNZI
@@ -287,4 +301,6 @@
 	#endif
 
+	__tls_rand_advance_bck();
+
 	// Unlock and return
 	__atomic_unlock( &lanes.data[i].lock );
@@ -311,8 +327,11 @@
 	/* paranoid */ verify( lanes.count > 0 );
 	unsigned count = __atomic_load_n( &lanes.count, __ATOMIC_RELAXED );
+	int preferred;
 	#if defined(BIAS)
 		// Don't bother trying locally too much
 		int local_tries = 8;
-	#endif
+		preferred = kernelTLS.this_processor->id * 4;
+	#endif
+
 
 	// As long as the list is not empty, try finding a lane that isn't empty and pop from it
@@ -323,36 +342,21 @@
 	#endif
 		// Pick two lists at random
-		unsigned i,j;
-		#if defined(BIAS)
-			#if !defined(__CFA_NO_STATISTICS__)
-				bool local = false;
-			#endif
-			uint64_t r = __tls_rand();
-			unsigned rlow  = r % BIAS;
-			uint64_t rhigh = r / BIAS;
-			if(local_tries && 0 != rlow) {
-				// (BIAS - 1) out of BIAS chances
-				// Use perferred queues
-				unsigned pid = kernelTLS.this_processor->id * 4;
-				i = pid + (rhigh % 4);
-				j = pid + ((rhigh >> 32ull) % 4);
-
-				// count the tries
-				local_tries--;
-
-				#if !defined(__CFA_NO_STATISTICS__)
-					local = true;
-					__tls_stats()->ready.pick.pop.local++;
-				#endif
-			}
-			else {
-				// 1 out of BIAS chances
-				// Use all queues
-				i = rhigh;
-				j = rhigh >> 32ull;
-			}
-		#else
-			i = __tls_rand();
-			j = __tls_rand();
+		// unsigned ri = __tls_rand();
+		// unsigned rj = __tls_rand();
+		unsigned ri = __tls_rand_bck();
+		unsigned rj = __tls_rand_bck();
+
+		unsigned i, j;
+		__attribute__((unused)) bool locali, localj;
+		[i, locali] = idx_from_r(ri, preferred);
+		[j, localj] = idx_from_r(rj, preferred);
+
+		#if !defined(__CFA_NO_STATISTICS__)
+			if(locali) {
+				__tls_stats()->ready.pick.pop.local++;
+			}
+			if(localj) {
+				__tls_stats()->ready.pick.pop.local++;
+			}
 		#endif
 
@@ -364,5 +368,5 @@
 		if(thrd) {
 			#if defined(BIAS) && !defined(__CFA_NO_STATISTICS__)
-				if( local ) __tls_stats()->ready.pick.pop.lsuccess++;
+				if( locali || localj ) __tls_stats()->ready.pick.pop.lsuccess++;
 			#endif
 			return thrd;
@@ -543,5 +547,5 @@
 
 		// Allocate new array (uses realloc and memcpies the data)
-		lanes.data = alloc(lanes.data, ncount);
+		lanes.data = alloc( ncount, lanes.data`realloc );
 
 		// Fix the moved data
@@ -634,5 +638,5 @@
 
 		// Allocate new array (uses realloc and memcpies the data)
-		lanes.data = alloc(lanes.data, lanes.count);
+		lanes.data = alloc( lanes.count, lanes.data`realloc );
 
 		// Fix the moved data
Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/exception.c	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -209,9 +209,11 @@
 		void * stop_param) {
 	// Verify actions follow the rules we expect.
-	verify((actions & _UA_CLEANUP_PHASE) && (actions & _UA_FORCE_UNWIND));
-	verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDLER_FRAME)));
+	verify(actions & _UA_CLEANUP_PHASE);
+	verify(actions & _UA_FORCE_UNWIND);
+	verify(!(actions & _UA_SEARCH_PHASE));
+	verify(!(actions & _UA_HANDLER_FRAME));
 
 	if ( actions & _UA_END_OF_STACK ) {
-		exit(1);
+		abort();
 	} else {
 		return _URC_NO_REASON;
@@ -219,11 +221,27 @@
 }
 
-static struct _Unwind_Exception cancel_exception_storage;
+__attribute__((weak)) _Unwind_Reason_Code
+__cfaehm_cancellation_unwind( struct _Unwind_Exception * exception ) {
+	return _Unwind_ForcedUnwind( exception, _Stop_Fn, (void*)0x22 );
+}
 
 // Cancel the current stack, prefroming approprate clean-up and messaging.
 void __cfaehm_cancel_stack( exception_t * exception ) {
-	// TODO: Detect current stack and pick a particular stop-function.
+	__cfaehm_allocate_exception( exception );
+
+	struct exception_context_t * context = this_exception_context();
+	struct __cfaehm_node * node = EXCEPT_TO_NODE(context->current_exception);
+
+	// Preform clean-up of any extra active exceptions.
+	while ( node->next ) {
+		struct __cfaehm_node * to_free = node->next;
+		node->next = to_free->next;
+		exception_t * except = NODE_TO_EXCEPT( to_free );
+		except->virtual_table->free( except );
+	    free( to_free );
+	}
+
 	_Unwind_Reason_Code ret;
-	ret = _Unwind_ForcedUnwind( &cancel_exception_storage, _Stop_Fn, (void*)0x22 );
+	ret = __cfaehm_cancellation_unwind( &node->unwind_exception );
 	printf("UNWIND ERROR %d after force unwind\n", ret);
 	abort();
Index: libcfa/src/stdlib.hfa
===================================================================
--- libcfa/src/stdlib.hfa	(revision 95472ee122aac2bc6a4be39aef8393326cc0aeb6)
+++ libcfa/src/stdlib.hfa	(revision d11d6ebdac4eb4d61f52ccf8176d113768ef6216)
@@ -114,141 +114,134 @@
 } // distribution
 
+/*
+	FIX ME : fix alloc interface after Ticker Number 214 is resolved, define and add union to S_fill. Then, modify postfix-fill functions to support T * with nmemb, char, and T object of any size. Finally, change alloc_internal.
+	Or, just follow the instructions below for that.
+
+	1. Replace the current forall-block that contains defintions of S_fill and S_realloc with following:
+		forall( dtype T | sized(T) ) {
+			union  U_fill 		{ char c; T * a; T t; };
+			struct S_fill 		{ char tag; char c; size_t size; T * at; char t[50]; };
+			struct S_realloc	{ inline T *; };
+		}
+
+	2. Replace all current postfix-fill functions with following for updated S_fill:
+		S_fill(T) ?`fill( char a )					{ S_fill(T) ret = {'c'}; ret.fill.c = a; return ret; }
+		S_fill(T) ?`fill( T    a ) 					{ S_fill(T) ret = {'t'}; memcpy(&ret.fill.t, &a, sizeof(T)); return ret; }
+		S_fill(T) ?`fill( T    a[], size_t nmemb ) 	{ S_fill(T) ret = {'a', nmemb}; ret.fill.a = a; return ret; }
+
+	3. Replace the $alloc_internal function which is outside ttype forall-block with following function:
+		T * $alloc_internal( void * Resize, T * Realloc, size_t Align, size_t Dim, S_fill(T) Fill) {
+			T * ptr = NULL;
+			size_t size = sizeof(T);
+			size_t copy_end = 0;
+
+			if(Resize) {
+				ptr = (T*) (void *) resize( (int *)Resize, Align, Dim * size );
+			} else if (Realloc) {
+				if (Fill.tag != '0') copy_end = min(malloc_size( Realloc ), Dim * size);
+				ptr = (T*) (void *) realloc( (int *)Realloc, Align, Dim * size );
+			} else {
+				ptr = (T*) (void *) memalign( Align, Dim * size );
+			}
+
+			if(Fill.tag == 'c') {
+				memset( (char *)ptr + copy_end, (int)Fill.fill.c, Dim * size - copy_end );
+			} else if(Fill.tag == 't') {
+				for ( int i = copy_end; i <= Dim * size - size ; i += size ) {
+					memcpy( (char *)ptr + i, &Fill.fill.t, size );
+				}
+			} else if(Fill.tag == 'a') {
+				memcpy( (char *)ptr + copy_end, Fill.fill.a, min(Dim * size - copy_end, size * Fill.nmemb) );
+			}
+
+			return ptr;
+		} // $alloc_internal
+*/
+
+typedef struct S_align 			{ inline size_t;  } T_align;
+typedef struct S_resize			{ inline void *;  }	T_resize;
+
+forall( dtype T ) {
+	struct S_fill 		{ char tag; char c; size_t size; T * at; char t[50]; };
+	struct S_realloc	{ inline T *; };
+}
+
+static inline T_align 	?`align   ( size_t a ) 	{ return (T_align){a}; }
+static inline T_resize 	?`resize  ( void * a )	{ return (T_resize){a}; }
 static inline forall( dtype T | sized(T) ) {
-	// Cforall safe general allocation, fill, resize, array
-
-	T * alloc( void ) {
-		return malloc();
-	} // alloc
-
-	T * alloc( size_t dim ) {
-		return aalloc( dim );
-	} // alloc
-
-	forall( dtype S | sized(S) )
-	T * alloc( S ptr[], size_t dim = 1 ) {				// singleton/array resize
-		return resize( (T *)ptr, dim * sizeof(T) );		// CFA resize
-	} // alloc
-
-	T * alloc( T ptr[], size_t dim = 1, bool copy = true ) {
-		if ( copy ) {
-			return realloc( ptr, dim * sizeof(T) );		// CFA realloc
+
+	S_fill(T) ?`fill ( T t ) {
+		S_fill(T) ret = { 't' };
+		size_t size = sizeof(T);
+		if(size > sizeof(ret.t)) { printf("ERROR: const object of size greater than 50 bytes given for dynamic memory fill\n"); exit(1); }
+		memcpy( &ret.t, &t, size );
+		return ret;
+	}
+	S_fill(T) 		?`fill ( char c ) 				{ return (S_fill(T)){ 'c', c };	}
+	S_fill(T) 		?`fill ( T * a ) 				{ return (S_fill(T)){ 'T', '0', 0, a }; }
+	S_fill(T) 		?`fill ( T a[], size_t nmemb ) 	{ return (S_fill(T)){ 'a', '0', nmemb * sizeof(T), a }; }
+
+	S_realloc(T) 	?`realloc ( T * a )				{ return (S_realloc(T)){a}; }
+
+	T * $alloc_internal( void * Resize, T * Realloc, size_t Align, size_t Dim, S_fill(T) Fill) {
+		T * ptr = NULL;
+		size_t size = sizeof(T);
+		size_t copy_end = 0;
+
+		if(Resize) {
+			ptr = (T*) (void *) resize( (int *)Resize, Align, Dim * size );
+		} else if (Realloc) {
+			if (Fill.tag != '0') copy_end = min(malloc_size( Realloc ), Dim * size);
+			ptr = (T*) (void *) realloc( (int *)Realloc, Align, Dim * size );
 		} else {
-			return resize( ptr, dim * sizeof(T) );		// CFA resize
-		} // if
-	} // alloc
-
-	T * alloc_set( char fill ) {
-		return (T *)memset( (T *)alloc(), (int)fill, sizeof(T) ); // initialize with fill value
-	} // alloc_set
-
-	T * alloc_set( const T & fill ) {
-		return (T *)memcpy( (T *)alloc(), &fill, sizeof(T) ); // initialize with fill value
-	} // alloc_set
-
-	T * alloc_set( size_t dim, char fill ) {
-		return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
-	} // alloc_set
-
-	T * alloc_set( size_t dim, const T & fill ) {
-		T * r = (T *)alloc( dim );
-		for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value
-		return r;
-	} // alloc_set
-
-	T * alloc_set( size_t dimNew, const T fill[], size_t dimOld ) {
-		return (T *)memcpy( (T *)alloc( dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) ); // initialize with fill value
-	} // alloc_set
-
-	T * alloc_set( T ptr[], size_t dim, char fill ) {	// realloc array with fill
-		size_t osize = malloc_size( ptr );				// current allocation
-		size_t nsize = dim * sizeof(T);					// new allocation
-		T * nptr = realloc( ptr, nsize );				// CFA realloc
-		if ( nsize > osize ) {							// larger ?
-			memset( (char *)nptr + osize, (int)fill, nsize - osize ); // initialize added storage
-		} // if
-		return nptr;
-	} // alloc_set
-
-	T * alloc_set( T ptr[], size_t dim, const T & fill ) {	// realloc array with fill
-		size_t odim = malloc_size( ptr ) / sizeof(T);	// current dimension
-		size_t nsize = dim * sizeof(T);					// new allocation
-		size_t ndim = nsize / sizeof(T);				// new dimension
-		T * nptr = realloc( ptr, nsize );				// CFA realloc
-		if ( ndim > odim ) {							// larger ?
-			for ( i; odim ~ ndim ) {
-				memcpy( &nptr[i], &fill, sizeof(T) );	// initialize with fill value
-			} // for
-		} // if
-		return nptr;
-	} // alloc_set
-} // distribution
-
-static inline forall( dtype T | sized(T) ) {
-	T * alloc_align( size_t align ) {
-		return (T *)memalign( align, sizeof(T) );
-	} // alloc_align
-
-	T * alloc_align( size_t align, size_t dim ) {
-		return (T *)memalign( align, dim * sizeof(T) );
-	} // alloc_align
-
-	T * alloc_align( T * ptr, size_t align ) {			// aligned realloc array
-		return (T *)(void *)realloc( (void *)ptr, align, sizeof(T) ); // CFA C realloc
-	} // alloc_align
-
-	forall( dtype S | sized(S) )
-	T * alloc_align( S ptr[], size_t align ) {			// aligned reuse array
-		return (T *)(void *)resize( (void *)ptr, align, sizeof(T) ); // CFA realloc
-	} // alloc_align
-
-	T * alloc_align( T ptr[], size_t align, size_t dim ) { // aligned realloc array
-		return (T *)(void *)realloc( (void *)ptr, align, dim * sizeof(T) ); // CFA realloc
-	} // alloc_align
-
-	T * alloc_align_set( size_t align, char fill ) {
-		return (T *)memset( (T *)alloc_align( align ), (int)fill, sizeof(T) ); // initialize with fill value
-	} // alloc_align_set
-
-	T * alloc_align_set( size_t align, const T & fill ) {
-		return (T *)memcpy( (T *)alloc_align( align ), &fill, sizeof(T) ); // initialize with fill value
-	} // alloc_align_set
-
-	T * alloc_align_set( size_t align, size_t dim, char fill ) {
-		return (T *)memset( (T *)alloc_align( align, dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
-	} // alloc_align_set
-
-	T * alloc_align_set( size_t align, size_t dim, const T & fill ) {
-		T * r = (T *)alloc_align( align, dim );
-		for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value
-		return r;
-	} // alloc_align_set
-
-	T * alloc_align_set( size_t align, size_t dimNew, const T fill[], size_t dimOld ) {
-		return (T *)memcpy( (T *)alloc_align( align, dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) );
-	} // alloc_align_set
-
-	T * alloc_align_set( T ptr[], size_t align, size_t dim, char fill ) {
-		size_t osize = malloc_size( ptr );				// current allocation
-		size_t nsize = dim * sizeof(T);					// new allocation
-		T * nptr = alloc_align( ptr, align, nsize );
-		if ( nsize > osize ) {							// larger ?
-			memset( (char *)nptr + osize, (int)fill, nsize - osize ); // initialize added storage
-		} // if
-		return nptr;
-	} // alloc_align_set
-
-	T * alloc_align_set( T ptr[], size_t align, size_t dim, const T & fill ) {
-		size_t odim = malloc_size( ptr ) / sizeof(T);	// current dimension
-		size_t nsize = dim * sizeof(T);					// new allocation
-		size_t ndim = nsize / sizeof(T);				// new dimension
-		T * nptr = alloc_align( ptr, align, nsize );
-		if ( ndim > odim ) {							// larger ?
-			for ( i; odim ~ ndim ) {
-				memcpy( &nptr[i], &fill, sizeof(T) );	// initialize with fill value
-			} // for
-		} // if
-		return nptr;
-	} // alloc_align_set
-} // distribution
+			ptr = (T*) (void *) memalign( Align, Dim * size );
+		}
+
+		if(Fill.tag == 'c') {
+			memset( (char *)ptr + copy_end, (int)Fill.c, Dim * size - copy_end );
+		} else if(Fill.tag == 't') {
+			for ( int i = copy_end; i <= Dim * size - size ; i += size ) {
+				memcpy( (char *)ptr + i, &Fill.t, size );
+			}
+		} else if(Fill.tag == 'a') {
+			memcpy( (char *)ptr + copy_end, Fill.at, min(Dim * size - copy_end, Fill.size) );
+		} else if(Fill.tag == 'T') {
+			for ( int i = copy_end; i <= Dim * size - size ; i += size ) {
+				memcpy( (char *)ptr + i, Fill.at, size );
+			}
+		}
+
+		return ptr;
+	} // $alloc_internal
+
+	forall( ttype TT | { T * $alloc_internal( void *, T *, size_t, size_t, S_fill(T), TT ); } ) {
+
+		T * $alloc_internal( void *       , T * Realloc, size_t Align, size_t Dim, S_fill(T) Fill, T_resize Resize, TT rest) {
+	        return $alloc_internal( Resize, (T*)0p, Align, Dim, Fill, rest);
+		}
+
+		T * $alloc_internal( void * Resize, T *        , size_t Align, size_t Dim, S_fill(T) Fill, S_realloc(T) Realloc, TT rest) {
+	        return $alloc_internal( (void*)0p, Realloc, Align, Dim, Fill, rest);
+		}
+
+		T * $alloc_internal( void * Resize, T * Realloc, size_t      , size_t Dim, S_fill(T) Fill, T_align Align, TT rest) {
+	        return $alloc_internal( Resize, Realloc, Align, Dim, Fill, rest);
+		}
+
+		T * $alloc_internal( void * Resize, T * Realloc, size_t Align, size_t Dim, S_fill(T)     , S_fill(T) Fill, TT rest) {
+	        return $alloc_internal( Resize, Realloc, Align, Dim, Fill, rest);
+		}
+
+	    T * alloc( TT all ) {
+	    	return $alloc_internal( (void*)0p, (T*)0p, (_Alignof(T) > libAlign() ? _Alignof(T) : libAlign()), (size_t)1, (S_fill(T)){'0'}, all);
+	    }
+
+	    T * alloc( size_t dim, TT all ) {
+	    	return $alloc_internal( (void*)0p, (T*)0p, (_Alignof(T) > libAlign() ? _Alignof(T) : libAlign()), dim, (S_fill(T)){'0'}, all);
+	    }
+
+	} // distribution TT
+
+} // distribution T
 
 static inline forall( dtype T | sized(T) ) {
