diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index ee0e61beeb8c359c0056087ca0bc7b7bd87ff0f4..9cf34e895f06e08fb45d8ba05e9b299a69fa4c95 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -76,6 +76,7 @@
 
 /* Number of dimensions the system has */
 #define SYSTEM_DIMENSIONS 1
+#define HIGHEST_DIMENSIONS 4
 
 /* Define to 1 if you have the `elan3' library (-lelan3). */
 #undef HAVE_ELAN
@@ -677,7 +678,7 @@ typedef struct job_descriptor {	/* For submit, allocate, and update requests */
  * they are needed for LCRM and others that can't talk to the opaque data type
  * select_jobinfo.
  */
-	uint16_t geometry[SYSTEM_DIMENSIONS];	/* node count in various
+	uint16_t geometry[HIGHEST_DIMENSIONS];	/* node count in various
 						 * dimensions, e.g. X, Y, and Z */
 	uint16_t conn_type;	/* see enum connection_type */
 	uint16_t reboot;	/* force node reboot before startup */
diff --git a/src/api/init_msg.c b/src/api/init_msg.c
index 6c749d6f4d47a941af7dac746583d5248d34e9ea..9ed36a2e66555a8c9518904b02d781608dd35214 100644
--- a/src/api/init_msg.c
+++ b/src/api/init_msg.c
@@ -57,8 +57,7 @@
 void slurm_init_job_desc_msg(job_desc_msg_t * job_desc_msg)
 {
 	int i;
-	int dims = working_cluster_rec ?
-		working_cluster_rec->dimensions : SYSTEM_DIMENSIONS;
+	int dims = slurmdb_setup_cluster_dims();
 
 	memset(job_desc_msg, 0, sizeof(job_desc_msg_t));
 	job_desc_msg->acctg_freq	= (uint16_t) NO_VAL;
diff --git a/src/common/proc_args.c b/src/common/proc_args.c
index 468bb89f95be190569757bf719a143a34546f6e8..6e387d41ed228c324a41bb3547d7860beab180af 100644
--- a/src/common/proc_args.c
+++ b/src/common/proc_args.c
@@ -202,8 +202,7 @@ int verify_geometry(const char *arg, uint16_t *geometry)
 	int i, rc = 0;
 	char* geometry_tmp = xstrdup(arg);
 	char* original_ptr = geometry_tmp;
-	int dims = working_cluster_rec ?
-		working_cluster_rec->dimensions : SYSTEM_DIMENSIONS;
+	int dims = slurmdb_setup_cluster_dims();
 
 	token = strtok_r(geometry_tmp, delimiter, &next_ptr);
 	for (i=0; i<dims; i++) {
@@ -756,8 +755,7 @@ char *print_geometry(const uint16_t *geometry)
 {
 	int i;
 	char buf[32], *rc = NULL;
-	int dims = working_cluster_rec ?
-		working_cluster_rec->dimensions : SYSTEM_DIMENSIONS;
+	int dims = slurmdb_setup_cluster_dims();
 
 	if ((dims == 0)
 	||  (geometry[0] == (uint16_t)NO_VAL))
diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c
index b68fb9a2966bffa7d6e66dd5961e32a00c6c5e7a..57b86c967af2013e053ed0ba4d33e6941ae576b1 100644
--- a/src/plugins/select/bluegene/block_allocator/block_allocator.c
+++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c
@@ -48,6 +48,7 @@
 #include "block_allocator.h"
 #include "src/common/uid.h"
 #include "src/common/timers.h"
+#include "src/common/slurmdb_defs.h"
 
 #define DEBUG_PA
 #define BEST_COUNT_INIT 20
@@ -65,6 +66,15 @@ List best_path = NULL;
 int best_count;
 int color_count = 0;
 uint16_t *deny_pass = NULL;
+#if (SYSTEM_DIMENSIONS == 1)
+int cluster_dims = 1;
+int cluster_base = 10;
+#else
+int cluster_dims = 3;
+int cluster_base = 36;
+#endif
+uint32_t cluster_flags = 0;
+char *p = '\0';
 
 /* extern Global */
 my_bluegene_t *bg = NULL;
@@ -72,13 +82,8 @@ uint16_t ba_deny_pass = 0;
 List bp_map_list = NULL;
 char letters[62];
 char colors[6];
-#ifdef HAVE_3D
-int DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0,0,0};
-int REAL_DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0,0,0};
-#else
-int DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0};
-int REAL_DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0};
-#endif
+int DIM_SIZE[HIGHEST_DIMENSIONS] = {0,0,0,0};
+int REAL_DIM_SIZE[HIGHEST_DIMENSIONS] = {0,0,0,0};
 
 s_p_options_t bg_conf_file_options[] = {
 #ifdef HAVE_BGL
@@ -114,7 +119,6 @@ typedef enum {
 	BLOCK_ALGO_SECOND
 } block_algo_t;
 
-#ifdef HAVE_BG
 /** internal helper functions */
 #ifdef HAVE_BG_FILES
 /** */
@@ -122,6 +126,7 @@ static void _bp_map_list_del(void *object);
 
 /** */
 static int _port_enum(int port);
+
 #endif /* HAVE_BG_FILES */
 
 /* */
@@ -142,16 +147,10 @@ static int _copy_the_path(List nodes, ba_switch_t *curr_switch,
 /* */
 static int _find_yz_path(ba_node_t *ba_node, int *first,
 			 int *geometry, int conn_type);
-#endif /* HAVE_BG */
 
 #ifndef HAVE_BG_FILES
-#ifdef HAVE_3D
 /* */
 static int _emulate_ext_wiring(ba_node_t ***grid);
-#else
-/* */
-static int _emulate_ext_wiring(ba_node_t *grid);
-#endif
 #endif
 
 /** */
@@ -466,56 +465,70 @@ extern void destroy_ba_node(void *ptr)
 extern int new_ba_request(ba_request_t* ba_request)
 {
 	int i=0;
-#ifdef HAVE_BG
 	float sz=1;
-	int geo[BA_SYSTEM_DIMENSIONS] = {0,0,0};
 	int i2, i3, picked, total_sz=1, size2=0;
-	int checked[DIM_SIZE[X]];
 	int *geo_ptr;
 	int messed_with = 0;
+	int checked[DIM_SIZE[X]];
+	int geo[cluster_dims];
 
+	memset(geo, 0, sizeof(geo));
 	ba_request->save_name= NULL;
 	ba_request->rotate_count= 0;
 	ba_request->elongate_count = 0;
 	ba_request->elongate_geos = list_create(_destroy_geo);
-	geo[X] = ba_request->geometry[X];
-	geo[Y] = ba_request->geometry[Y];
-	geo[Z] = ba_request->geometry[Z];
+	memcpy(geo, ba_request->geometry, sizeof(geo));
+
 	if(ba_request->deny_pass == (uint16_t)NO_VAL)
 		ba_request->deny_pass = ba_deny_pass;
 
-	deny_pass = &ba_request->deny_pass;
+	if(!(cluster_flags & CLUSTER_FLAG_BG)) {
+		if(geo[X] != NO_VAL) {
+			for (i=0; i<cluster_dims; i++){
+				if ((geo[i] < 1) || (geo[i] > DIM_SIZE[i])) {
+					error("new_ba_request Error, "
+					      "request geometry is invalid %d",
+					      geo[i]);
+					return 0;
+				}
+			}
+			ba_request->size = ba_request->geometry[X];
+		} else if (ba_request->size) {
+			ba_request->geometry[X] = ba_request->size;
+		} else
+			return 0;
+		return 1;
+	}
 
 	if(geo[X] != (uint16_t)NO_VAL) {
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){
-			if ((geo[i] < 1)
-			    ||  (geo[i] > DIM_SIZE[i])){
+		for (i=0; i<cluster_dims; i++){
+			if ((geo[i] < 1) || (geo[i] > DIM_SIZE[i])) {
 				error("new_ba_request Error, "
-				      "request geometry is invalid %d can't be "
-				      "%d, DIMS are %c%c%c",
+				      "request geometry is invalid dim %d "
+				      "can't be %c, largest is %c",
 				      i,
-				      geo[i],
-				      alpha_num[DIM_SIZE[X]],
-				      alpha_num[DIM_SIZE[Y]],
-				      alpha_num[DIM_SIZE[Z]]);
+				      alpha_num[geo[i]],
+				      alpha_num[DIM_SIZE[i]]);
 				return 0;
 			}
 		}
 		_append_geo(geo, ba_request->elongate_geos, 0);
 		sz=1;
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+		for (i=0; i<cluster_dims; i++)
 			sz *= ba_request->geometry[i];
 		ba_request->size = sz;
 		sz=0;
 	}
 
+	deny_pass = &ba_request->deny_pass;
+
 	if(ba_request->elongate || sz) {
 		sz=1;
 		/* decompose the size into a cubic geometry */
 		ba_request->rotate= 1;
 		ba_request->elongate = 1;
 
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
+		for (i=0; i<cluster_dims; i++) {
 			total_sz *= DIM_SIZE[i];
 			geo[i] = 1;
 		}
@@ -577,7 +590,7 @@ extern int new_ba_request(ba_request_t* ba_request)
 		for(i=0; i<DIM_SIZE[X]; i++)
 			checked[i]=0;
 
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
+		for (i=0; i<cluster_dims; i++) {
 			total_sz *= DIM_SIZE[i];
 			geo[i] = 1;
 		}
@@ -587,7 +600,7 @@ extern int new_ba_request(ba_request_t* ba_request)
 	tryagain:
 		size2 = ba_request->size;
 		//messedup:
-		for (i=picked; i<BA_SYSTEM_DIMENSIONS; i++) {
+		for (i=picked; i<cluster_dims; i++) {
 			if(size2 <= 1)
 				break;
 
@@ -613,7 +626,7 @@ extern int new_ba_request(ba_request_t* ba_request)
 							goto tryagain;
 						}
 						if((i2-1)!=1 &&
-						   i!=(BA_SYSTEM_DIMENSIONS-1))
+						   i!=(cluster_dims-1))
 							break;
 					}
 				}
@@ -731,20 +744,20 @@ extern int new_ba_request(ba_request_t* ba_request)
 
 		/* see if We can find a cube or square root of the
 		   size to make an easy cube */
-		for(i=0;i<BA_SYSTEM_DIMENSIONS-1;i++) {
+		for(i=0;i<cluster_dims-1;i++) {
 			sz = powf((float)ba_request->size,
-				  (float)1/(BA_SYSTEM_DIMENSIONS-i));
-			if(pow(sz,(BA_SYSTEM_DIMENSIONS-i))==ba_request->size)
+				  (float)1/(cluster_dims-i));
+			if(pow(sz,(cluster_dims-i))==ba_request->size)
 				break;
 		}
 
-		if(i<BA_SYSTEM_DIMENSIONS-1) {
+		if(i<cluster_dims-1) {
 			/* we found something that looks like a cube! */
 			i3=i;
 			for (i=0; i<i3; i++)
 				geo[i] = 1;
 
-			for (i=i3; i<BA_SYSTEM_DIMENSIONS; i++)
+			for (i=i3; i<cluster_dims; i++)
 				if(sz<=DIM_SIZE[i])
 					geo[i] = sz;
 				else
@@ -773,37 +786,10 @@ endit:
 	ba_request->geometry[Y] = geo_ptr[Y];
 	ba_request->geometry[Z] = geo_ptr[Z];
 	sz=1;
-	for (i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+	for (i=0; i<cluster_dims; i++)
 		sz *= ba_request->geometry[i];
 	ba_request->size = sz;
 
-#else
-	int geo[BA_SYSTEM_DIMENSIONS] = {0};
-
-	ba_request->rotate_count= 0;
-	ba_request->elongate_count = 0;
-	ba_request->elongate_geos = list_create(_destroy_geo);
-	geo[X] = ba_request->geometry[X];
-
-	if(geo[X] != NO_VAL) {
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){
-			if ((geo[i] < 1)
-			    ||  (geo[i] > DIM_SIZE[i])){
-				error("new_ba_request Error, "
-				      "request geometry is invalid %d",
-				      geo[i]);
-				return 0;
-			}
-		}
-
-		ba_request->size = ba_request->geometry[X];
-
-	} else if (ba_request->size) {
-		ba_request->geometry[X] = ba_request->size;
-	} else
-		return 0;
-
-#endif
 	return 1;
 }
 
@@ -841,7 +827,7 @@ extern void print_ba_request(ba_request_t* ba_request)
 	}
 	debug("  ba_request:");
 	debug("    geometry:\t");
-	for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){
+	for (i=0; i<cluster_dims; i++){
 		debug("%d", ba_request->geometry[i]);
 	}
 	debug("        size:\t%d", ba_request->size);
@@ -871,25 +857,23 @@ extern int empty_null_destroy_list(void *arg, void *key)
 extern void ba_init(node_info_msg_t *node_info_ptr, bool sanity_check)
 {
 	int x,y,z;
-
-#ifdef HAVE_3D
 	node_info_t *node_ptr = NULL;
-	int start, temp;
+	int number, count;
 	char *numeric = NULL;
-	int i, j=0;
+	int i, j, k;
 	slurm_conf_node_t *node = NULL, **ptr_array;
-	int count, number;
-	int end[BA_SYSTEM_DIMENSIONS];
+	int coords[cluster_dims];
 
 #ifdef HAVE_BG_FILES
 	rm_size3D_t bp_size;
 	int rc = 0;
 #endif /* HAVE_BG_FILES */
 
-#endif /* HAVE_3D */
+	cluster_dims = slurmdb_setup_cluster_dims();
+	cluster_flags = slurmdb_setup_cluster_flags();
 
 	/* We only need to initialize once, so return if already done so. */
-	if (_initialized){
+	if (_initialized) {
 		return;
 	}
 
@@ -927,11 +911,32 @@ extern void ba_init(node_info_msg_t *node_info_ptr, bool sanity_check)
 
 	ba_system_ptr->num_of_proc = 0;
 
-	if(node_info_ptr!=NULL) {
-#ifdef HAVE_3D
+	/* cluster_dims is already set up off of working_cluster_rec */
+	if(cluster_dims == 1) {
+		if(node_info_ptr) {
+			REAL_DIM_SIZE[X] = DIM_SIZE[X] =
+				node_info_ptr->record_count + 1;
+			ba_system_ptr->num_of_proc =
+				node_info_ptr->record_count;
+			REAL_DIM_SIZE[Y] = DIM_SIZE[Y] = 1;
+			REAL_DIM_SIZE[Z] = DIM_SIZE[Z] = 1;
+		}
+		goto setup_done;
+	} else if(working_cluster_rec) {
+		if(working_cluster_rec->dim_size) {
+			for(i=0; i<working_cluster_rec->dimensions; i++) {
+				DIM_SIZE[i] = working_cluster_rec->dim_size[i];
+				REAL_DIM_SIZE[i] = DIM_SIZE[i];
+			}
+		}
+		goto setup_done;
+	}
+
+
+	if(node_info_ptr) {
 		for (i = 0; i < node_info_ptr->record_count; i++) {
 			node_ptr = &node_info_ptr->node_array[i];
-			start = 0;
+			number = 0;
 
 			if(!node_ptr->name) {
 				DIM_SIZE[X] = 0;
@@ -948,36 +953,24 @@ extern void ba_init(node_info_msg_t *node_info_ptr, bool sanity_check)
 					numeric++;
 					continue;
 				}
-				start = xstrntol(numeric, NULL,
-						 BA_SYSTEM_DIMENSIONS,
-						 HOSTLIST_BASE);
+				number = strtoul(numeric, &p, cluster_base);
 				break;
 			}
+			hostlist_parse_int_to_array(
+				number, coords, cluster_dims, cluster_base);
 
-			temp = start / (HOSTLIST_BASE * HOSTLIST_BASE);
-			if (DIM_SIZE[X] < temp)
-				DIM_SIZE[X] = temp;
-			temp = (start % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			if (DIM_SIZE[Y] < temp)
-				DIM_SIZE[Y] = temp;
-			temp = start % HOSTLIST_BASE;
-			if (DIM_SIZE[Z] < temp)
-				DIM_SIZE[Z] = temp;
+			for(j=0; j<cluster_dims; j++) {
+				if(DIM_SIZE[j] < coords[j])
+					DIM_SIZE[j] = coords[j];
+			}
+		}
+		for(j=0; j<cluster_dims; j++) {
+			DIM_SIZE[j]++;
+			/* this will probably be reset below */
+			REAL_DIM_SIZE[j] = DIM_SIZE[j];
 		}
-		DIM_SIZE[X]++;
-		DIM_SIZE[Y]++;
-		DIM_SIZE[Z]++;
-		/* this will probably be reset below */
-		REAL_DIM_SIZE[X] = DIM_SIZE[X];
-		REAL_DIM_SIZE[Y] = DIM_SIZE[Y];
-		REAL_DIM_SIZE[Z] = DIM_SIZE[Z];
-#else
-		DIM_SIZE[X] = node_info_ptr->record_count;
-#endif
 		ba_system_ptr->num_of_proc = node_info_ptr->record_count;
 	}
-#ifdef HAVE_3D
 node_info_error:
 
 	if ((DIM_SIZE[X]==0) || (DIM_SIZE[Y]==0) || (DIM_SIZE[Z]==0)) {
@@ -1009,21 +1002,16 @@ node_info_error:
 					j++;
 					continue;
 				}
-				number = xstrntol(node->nodenames + j,
-						  NULL, BA_SYSTEM_DIMENSIONS,
-						  HOSTLIST_BASE);
-
-				end[X] = number
-					/ (HOSTLIST_BASE * HOSTLIST_BASE);
-				end[Y] = (number
-					  % (HOSTLIST_BASE * HOSTLIST_BASE))
-					/ HOSTLIST_BASE;
-				end[Z] = (number % HOSTLIST_BASE);
+				number = strtoul(node->nodenames + j,
+						 &p, cluster_base);
+				hostlist_parse_int_to_array(
+					number, coords, cluster_dims,
+					cluster_base);
 				j += 3;
 
-				DIM_SIZE[X] = MAX(DIM_SIZE[X], end[X]);
-				DIM_SIZE[Y] = MAX(DIM_SIZE[Y], end[Y]);
-				DIM_SIZE[Z] = MAX(DIM_SIZE[Z], end[Z]);
+				for(k=0; k<cluster_dims; k++)
+					DIM_SIZE[k] = MAX(DIM_SIZE[k],
+							  coords[k]);
 
 				if(node->nodenames[j] != ',')
 					break;
@@ -1031,14 +1019,12 @@ node_info_error:
 		}
 		if ((DIM_SIZE[X]==0) && (DIM_SIZE[Y]==0) && (DIM_SIZE[Z]==0))
 			info("are you sure you only have 1 midplane? %s",
-			      node->nodenames);
-		DIM_SIZE[X]++;
-		DIM_SIZE[Y]++;
-		DIM_SIZE[Z]++;
-		/* this will probably be reset below */
-		REAL_DIM_SIZE[X] = DIM_SIZE[X];
-		REAL_DIM_SIZE[Y] = DIM_SIZE[Y];
-		REAL_DIM_SIZE[Z] = DIM_SIZE[Z];
+			     node->nodenames);
+		for(j=0; j<cluster_dims; j++) {
+			DIM_SIZE[j]++;
+			/* this will probably be reset below */
+			REAL_DIM_SIZE[j] = DIM_SIZE[j];
+		}
 	}
 #ifdef HAVE_BG_FILES
 	/* sanity check.  We can only request part of the system, but
@@ -1082,29 +1068,30 @@ node_info_error:
 	}
 #endif
 
+setup_done:
+	if(cluster_dims == 1) {
+		if (DIM_SIZE[X]==0) {
+			debug("Setting default system dimensions");
+			REAL_DIM_SIZE[X] = DIM_SIZE[X]=100;
+			REAL_DIM_SIZE[Y] = DIM_SIZE[Y]=1;
+			REAL_DIM_SIZE[Z] = DIM_SIZE[Z]=1;
+		}
+	} else {
+		debug("We are using %c x %c x %c of the system.",
+		      alpha_num[DIM_SIZE[X]],
+		      alpha_num[DIM_SIZE[Y]],
+		      alpha_num[DIM_SIZE[Z]]);
+	}
 
-	debug("We are using %c x %c x %c of the system.",
-	      alpha_num[DIM_SIZE[X]],
-	      alpha_num[DIM_SIZE[Y]],
-	      alpha_num[DIM_SIZE[Z]]);
-
-#else
-	if (DIM_SIZE[X]==0) {
-		debug("Setting default system dimensions");
-		DIM_SIZE[X]=100;
+	if(!ba_system_ptr->num_of_proc) {
+		ba_system_ptr->num_of_proc = 1;
+		for(i=0; i<cluster_dims; i++)
+			ba_system_ptr->num_of_proc *= DIM_SIZE[i];
 	}
-#endif
-	if(!ba_system_ptr->num_of_proc)
-		ba_system_ptr->num_of_proc =
-			DIM_SIZE[X]
-#ifdef HAVE_3D
-			* DIM_SIZE[Y]
-			* DIM_SIZE[Z]
-#endif
-			;
 
 	_create_ba_system();
 
+
 #ifndef HAVE_BG_FILES
 	_emulate_ext_wiring(ba_system_ptr->grid);
 #endif
@@ -1131,11 +1118,7 @@ extern void init_wires()
 	for(x=0;x<DIM_SIZE[X];x++) {
 		for(y=0;y<DIM_SIZE[Y];y++) {
 			for(z=0;z<DIM_SIZE[Z];z++) {
-#ifdef HAVE_3D
 				source = &ba_system_ptr->grid[x][y][z];
-#else
-				source = &ba_system_ptr->grid[x];
-#endif
 				for(i=0; i<NUM_PORTS_PER_NODE; i++) {
 					_switch_config(source, source,
 						       X, i, i);
@@ -1292,7 +1275,7 @@ extern int copy_node_path(List nodes, List *dest_nodes)
 
 		}
 		new_ba_node->used = true;
-		for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) {
+		for(dim=0;dim<cluster_dims;dim++) {
 			curr_switch = &ba_node->axis_switch[dim];
 			new_switch = &new_ba_node->axis_switch[dim];
 			if(curr_switch->int_wire[0].used) {
@@ -1362,11 +1345,8 @@ extern int remove_block(List nodes, int new_count, int conn_type)
 		   to the main list we need to point to that main list */
 		ba_node = &ba_system_ptr->
 			grid[curr_ba_node->coord[X]]
-#ifdef HAVE_BG
 			[curr_ba_node->coord[Y]]
-			[curr_ba_node->coord[Z]]
-#endif
-			;
+			[curr_ba_node->coord[Z]];
 
 		ba_node->used = false;
 		ba_node->color = 7;
@@ -1375,7 +1355,7 @@ extern int remove_block(List nodes, int new_count, int conn_type)
 		   so just break. */
 		if(conn_type == SELECT_SMALL)
 			break;
-		for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) {
+		for(dim=0;dim<cluster_dims;dim++) {
 			curr_switch = &ba_node->axis_switch[dim];
 			if(curr_switch->int_wire[0].used) {
 				_reset_the_path(curr_switch, 0, 1, dim);
@@ -1413,7 +1393,7 @@ extern int alter_block(List nodes, int conn_type)
 /* 	while ((ba_node = list_next(results_i)) != NULL) { */
 /* 		ba_node->used = false; */
 
-/* 		for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) { */
+/* 		for(dim=0;dim<cluster_dims;dim++) { */
 /* 			curr_switch = &ba_node->axis_switch[dim]; */
 /* 			if(curr_switch->int_wire[0].used) { */
 /* 				_reset_the_path(curr_switch, 0, 1, dim); */
@@ -1517,7 +1497,7 @@ extern int check_and_set_node_list(List nodes)
 
 		if(ba_node->used)
 			curr_ba_node->used = true;
-		for(i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
+		for(i=0; i<cluster_dims; i++) {
 			ba_switch = &ba_node->axis_switch[i];
 			curr_ba_switch = &curr_ba_node->axis_switch[i];
 			//info("checking dim %d", i);
@@ -1588,30 +1568,29 @@ extern char *set_bg_block(List results, int *start,
 	int found = 0;
 
 
-#ifdef HAVE_3D
-	if(start[X]>=DIM_SIZE[X]
-	   || start[Y]>=DIM_SIZE[Y]
-	   || start[Z]>=DIM_SIZE[Z])
-		return NULL;
+	if(cluster_dims == 1) {
+		if(start[X]>=DIM_SIZE[X])
+			return NULL;
+		size = geometry[X];
+		ba_node = &ba_system_ptr->grid[start[X]][0][0];
+	} else {
+		if(start[X]>=DIM_SIZE[X]
+		   || start[Y]>=DIM_SIZE[Y]
+		   || start[Z]>=DIM_SIZE[Z])
+			return NULL;
 
-	if(geometry[X] <= 0 || geometry[Y] <= 0 || geometry[Z] <= 0) {
-		error("problem with geometry %c%c%c, needs to be at least 111",
-		      alpha_num[geometry[X]],
-		      alpha_num[geometry[Y]],
-		      alpha_num[geometry[Z]]);
-		return NULL;
+		if(geometry[X] <= 0 || geometry[Y] <= 0 || geometry[Z] <= 0) {
+			error("problem with geometry %c%c%c, needs to be "
+			      "at least 111",
+			      alpha_num[geometry[X]],
+			      alpha_num[geometry[Y]],
+			      alpha_num[geometry[Z]]);
+			return NULL;
+		}
+	     //info("looking at %d%d%d", geometry[X], geometry[Y], geometry[Z]);
+		size = geometry[X] * geometry[Y] * geometry[Z];
+		ba_node = &ba_system_ptr->grid[start[X]][start[Y]][start[Z]];
 	}
-	//info("looking at %d%d%d", geometry[X], geometry[Y], geometry[Z]);
-
-	size = geometry[X] * geometry[Y] * geometry[Z];
-	ba_node = &ba_system_ptr->grid[start[X]][start[Y]][start[Z]];
-#else
-	if(start[X]>=DIM_SIZE[X])
-		return NULL;
-	size = geometry[X];
-	ba_node = &ba_system_ptr->grid[start[X]];
-#endif
-
 
 	if(!ba_node)
 		return NULL;
@@ -1660,26 +1639,26 @@ extern char *set_bg_block(List results, int *start,
 				     conn_type, BLOCK_ALGO_SECOND);
 	}
 	if(found) {
-#ifdef HAVE_BG
-		List start_list = NULL;
-		ListIterator itr;
+		if(cluster_flags & CLUSTER_FLAG_BG) {
+			List start_list = NULL;
+			ListIterator itr;
 
-		start_list = list_create(NULL);
-		itr = list_iterator_create(results);
-		while((ba_node = (ba_node_t*) list_next(itr))) {
-			list_append(start_list, ba_node);
-		}
-		list_iterator_destroy(itr);
+			start_list = list_create(NULL);
+			itr = list_iterator_create(results);
+			while((ba_node = (ba_node_t*) list_next(itr))) {
+				list_append(start_list, ba_node);
+			}
+			list_iterator_destroy(itr);
 
-		if(!_fill_in_coords(results,
-				    start_list,
-				    geometry,
-				    conn_type)) {
+			if(!_fill_in_coords(results,
+					    start_list,
+					    geometry,
+					    conn_type)) {
+				list_destroy(start_list);
+				goto end_it;
+			}
 			list_destroy(start_list);
-			goto end_it;
 		}
-		list_destroy(start_list);
-#endif
 	} else {
 		goto end_it;
 	}
@@ -1708,14 +1687,10 @@ end_it:
  */
 extern int reset_ba_system(bool track_down_nodes)
 {
-	int x;
-#ifdef HAVE_3D
-	int y, z;
-#endif
-	int coord[BA_SYSTEM_DIMENSIONS];
+	int x, y, z;
+	int coord[cluster_dims];
 
 	for (x = 0; x < DIM_SIZE[X]; x++) {
-#ifdef HAVE_3D
 		for (y = 0; y < DIM_SIZE[Y]; y++)
 			for (z = 0; z < DIM_SIZE[Z]; z++) {
 				coord[X] = x;
@@ -1724,11 +1699,6 @@ extern int reset_ba_system(bool track_down_nodes)
 				_new_ba_node(&ba_system_ptr->grid[x][y][z],
 					     coord, track_down_nodes);
 			}
-#else
-		coord[X] = x;
-		_new_ba_node(&ba_system_ptr->grid[x], coord, track_down_nodes);
-
-#endif
 	}
 
 	return 1;
@@ -1750,8 +1720,8 @@ extern int removable_set_bps(char *bps)
 	int j=0, number;
 	int x;
 	int y,z;
-	int start[BA_SYSTEM_DIMENSIONS];
-	int end[BA_SYSTEM_DIMENSIONS];
+	int start[cluster_dims];
+	int end[cluster_dims];
 
 	if(!bps)
 		return SLURM_ERROR;
@@ -1762,18 +1732,13 @@ extern int removable_set_bps(char *bps)
 		    && (bps[j+4] == 'x' || bps[j+4] == '-')) {
 
 			j++;
-			number = xstrntol(bps + j, NULL, BA_SYSTEM_DIMENSIONS,
-					  HOSTLIST_BASE);
-			start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			start[Z] = (number % HOSTLIST_BASE);
+			number = strtoul(bps + j, &p, cluster_base);
+			hostlist_parse_int_to_array(
+				number, start, cluster_dims, cluster_base);
 			j += 4;
-			number = xstrntol(bps + j, NULL, 3, HOSTLIST_BASE);
-			end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			end[Z] = (number % HOSTLIST_BASE);
+			number = strtoul(bps + j, &p, cluster_base);
+			hostlist_parse_int_to_array(
+				number, end, cluster_dims, cluster_base);
 			j += 3;
 			for (x = start[X]; x <= end[X]; x++) {
 				for (y = start[Y]; y <= end[Y]; y++) {
@@ -1792,13 +1757,12 @@ extern int removable_set_bps(char *bps)
 			j--;
 		} else if((bps[j] >= '0' && bps[j] <= '9')
 			  || (bps[j] >= 'A' && bps[j] <= 'Z')) {
-
-			number = xstrntol(bps + j, NULL, BA_SYSTEM_DIMENSIONS,
-					  HOSTLIST_BASE);
-			x = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			y = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			z = (number % HOSTLIST_BASE);
+			number = strtoul(bps + j, &p, cluster_base);
+			hostlist_parse_int_to_array(
+				number, start, cluster_dims, cluster_base);
+			x = start[X];
+			y = start[Y];
+			z = start[Z];
 			j+=3;
 			if(!ba_system_ptr->grid[x][y][z].used)
 				ba_system_ptr->grid[x][y][z].used = 2;
@@ -1819,19 +1783,13 @@ extern int removable_set_bps(char *bps)
  */
 extern int reset_all_removed_bps()
 {
-	int x;
+	int x, y, z;
 
 	for (x = 0; x < DIM_SIZE[X]; x++) {
-#ifdef HAVE_3D
-		int y, z;
 		for (y = 0; y < DIM_SIZE[Y]; y++)
 			for (z = 0; z < DIM_SIZE[Z]; z++)
 				if(ba_system_ptr->grid[x][y][z].used == 2)
 					ba_system_ptr->grid[x][y][z].used = 0;
-#else
-		if(ba_system_ptr->grid[x].used == 2)
-			ba_system_ptr->grid[x].used = 0;
-#endif
 	}
 	return SLURM_SUCCESS;
 }
@@ -1849,17 +1807,16 @@ extern int reset_all_removed_bps()
  */
 extern int set_all_bps_except(char *bps)
 {
-	int x;
-#ifdef HAVE_3D
-	int y, z;
-#endif
+	int x, y, z;
 	hostlist_t hl = hostlist_create(bps);
 	char *host = NULL, *numeric = NULL;
-	int start, temp;
+	int number, coords[HIGHEST_DIMENSIONS];
+
+	memset(coords, 0, sizeof(coords));
 
 	while((host = hostlist_shift(hl))){
 		numeric = host;
-		start = 0;
+		number = 0;
 		while (numeric) {
 			if (numeric[0] < '0' || numeric[0] > 'Z'
 			    || (numeric[0] > '9'
@@ -1867,31 +1824,18 @@ extern int set_all_bps_except(char *bps)
 				numeric++;
 				continue;
 			}
-			start = xstrntol(numeric, NULL,
-					 BA_SYSTEM_DIMENSIONS,
-					 HOSTLIST_BASE);
+			number = strtoul(numeric, &p, cluster_base);
 			break;
 		}
-
-		temp = start / (HOSTLIST_BASE * HOSTLIST_BASE);
-		x = temp;
-#ifdef HAVE_3D
-		temp = (start % (HOSTLIST_BASE * HOSTLIST_BASE))
-			/ HOSTLIST_BASE;
-		y = temp;
-		temp = start % HOSTLIST_BASE;
-		z = temp;
-		/* mark with an impossible state bit */
-		ba_system_ptr->grid[x][y][z].state |= NODE_RESUME;
-#else
-		ba_system_ptr->grid[x].state |= NODE_RESUME;
-#endif
+		hostlist_parse_int_to_array(
+			number, coords, cluster_dims, cluster_base);
+		ba_system_ptr->grid[coords[X]][coords[Y]][coords[Z]].state
+			|= NODE_RESUME;
 		free(host);
 	}
 	hostlist_destroy(hl);
 
 	for (x = 0; x < DIM_SIZE[X]; x++) {
-#ifdef HAVE_3D
 		for (y = 0; y < DIM_SIZE[Y]; y++)
 			for (z = 0; z < DIM_SIZE[Z]; z++) {
 				if(ba_system_ptr->grid[x][y][z].state
@@ -1903,14 +1847,6 @@ extern int set_all_bps_except(char *bps)
 					ba_system_ptr->grid[x][y][z].used = 2;
 				}
 			}
-#else
-		if(ba_system_ptr->grid[x].state & NODE_RESUME) {
-			/* clear the bit and mark as unused */
-			ba_system_ptr->grid[x].state &= ~NODE_RESUME;
-		} else if(!ba_system_ptr->grid[x].used) {
-			ba_system_ptr->grid[x].used = 2;
-		}
-#endif
 	}
 
  	return SLURM_SUCCESS;
@@ -1922,12 +1858,10 @@ extern int set_all_bps_except(char *bps)
 extern void init_grid(node_info_msg_t * node_info_ptr)
 {
 	node_info_t *node_ptr = NULL;
-	int x, i = 0;
+	int x, y, z, i = 0;
 	/* For systems with more than 62 active jobs or BG blocks,
 	 * we just repeat letters */
 
-#ifdef HAVE_3D
-	int y,z;
 	for (x = 0; x < DIM_SIZE[X]; x++)
 		for (y = 0; y < DIM_SIZE[Y]; y++)
 			for (z = 0; z < DIM_SIZE[Z]; z++) {
@@ -1945,9 +1879,10 @@ extern void init_grid(node_info_msg_t * node_info_ptr)
 							= '#';
 						if(_initialized) {
 							ba_update_node_state(
-							&ba_system_ptr->
-							grid[x][y][z],
-							node_ptr->node_state);
+								&ba_system_ptr->
+								grid[x][y][z],
+								node_ptr->
+								node_state);
 						}
 					} else {
 						ba_system_ptr->grid[x][y][z].
@@ -1966,32 +1901,7 @@ extern void init_grid(node_info_msg_t * node_info_ptr)
 				}
 				ba_system_ptr->grid[x][y][z].index = i++;
 			}
-#else
-	for (x = 0; x < DIM_SIZE[X]; x++) {
-		if(node_info_ptr!=NULL) {
-			node_ptr = &node_info_ptr->node_array[i];
-			ba_system_ptr->grid[x].color = 7;
-			if (IS_NODE_DOWN(node_ptr) || IS_NODE_DRAIN(node_ptr)) {
-				ba_system_ptr->grid[x].color = 0;
-				ba_system_ptr->grid[x].letter = '#';
-				if(_initialized) {
-					ba_update_node_state(
-						&ba_system_ptr->grid[x],
-						node_ptr->node_state);
-				}
-			} else {
-				ba_system_ptr->grid[x].color = 7;
-				ba_system_ptr->grid[x].letter = '.';
-			}
-			ba_system_ptr->grid[x].state = node_ptr->node_state;
-		} else {
-			ba_system_ptr->grid[x].color = 7;
-			ba_system_ptr->grid[x].letter = '.';
-			ba_system_ptr->grid[x].state = NODE_STATE_IDLE;
-		}
-		ba_system_ptr->grid[x].index = i++;
-	}
-#endif
+
 	return;
 }
 
@@ -2122,18 +2032,6 @@ extern int set_bp_map(void)
 		bp_map->coord[Y] = bp_loc.Y;
 		bp_map->coord[Z] = bp_loc.Z;
 
-		number = xstrntol(bp_id+1, NULL,
-				  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-/* no longer needed for calculation */
-/* 		if(DIM_SIZE[X] > bp_loc.X */
-/* 		   && DIM_SIZE[Y] > bp_loc.Y */
-/* 		   && DIM_SIZE[Z] > bp_loc.Z) */
-/* 			ba_system_ptr->grid */
-/* 				[bp_loc.X] */
-/* 				[bp_loc.Y] */
-/* 				[bp_loc.Z].phys_x = */
-/* 				number / (HOSTLIST_BASE * HOSTLIST_BASE); */
-
 		list_push(bp_map_list, bp_map);
 
 		free(bp_id);
@@ -2221,7 +2119,7 @@ extern char *find_bp_rack_mid(char* xyz)
 	ba_bp_map_t *bp_map = NULL;
 	ListIterator itr;
 	int number;
-	int coord[BA_SYSTEM_DIMENSIONS];
+	int coord[cluster_dims];
 	int len = strlen(xyz);
 	len -= 3;
 	if(len<0)
@@ -2234,13 +2132,8 @@ extern char *find_bp_rack_mid(char* xyz)
 		return NULL;
 	}
 
-
-	number = xstrntol(&xyz[X]+len, NULL,
-			  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-	coord[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-	coord[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE)) / HOSTLIST_BASE;
-	coord[Z] = (number % HOSTLIST_BASE);
-
+	number = strtoul(xyz[X]+len, &p, cluster_base);
+	hostlist_parse_int_to_array(number, coord, cluster_dims, cluster_base);
 
 	if(!bp_map_list) {
 		if(set_bp_map() == -1)
@@ -2764,8 +2657,6 @@ extern int validate_coord(int *coord)
 
 /********************* Local Functions *********************/
 
-#ifdef HAVE_BG
-
 #ifdef HAVE_BG_FILES
 static void _bp_map_list_del(void *object)
 {
@@ -2821,14 +2712,14 @@ static int _check_for_options(ba_request_t* ba_request)
 	rotate_again:
 		debug2("Rotating! %d",ba_request->rotate_count);
 
-		if (ba_request->rotate_count==(BA_SYSTEM_DIMENSIONS-1)) {
+		if (ba_request->rotate_count==(cluster_dims-1)) {
 			temp=ba_request->geometry[X];
 			ba_request->geometry[X]=ba_request->geometry[Z];
 			ba_request->geometry[Z]=temp;
 			ba_request->rotate_count++;
 			set=1;
 
-		} else if(ba_request->rotate_count<(BA_SYSTEM_DIMENSIONS*2)) {
+		} else if(ba_request->rotate_count<(cluster_dims*2)) {
 			temp=ba_request->geometry[X];
 			ba_request->geometry[X]=ba_request->geometry[Y];
 			ba_request->geometry[Y]=ba_request->geometry[Z];
@@ -2888,7 +2779,7 @@ static int _append_geo(int *geometry, List geos, int rotate)
 	int i, j;
 
 	if(rotate) {
-		for (i = (BA_SYSTEM_DIMENSIONS - 1); i >= 0; i--) {
+		for (i = (cluster_dims - 1); i >= 0; i--) {
 			for (j = 1; j <= i; j++) {
 				if ((geometry[j-1] > geometry[j])
 				    && (geometry[j] <= DIM_SIZE[j-i])
@@ -2911,7 +2802,7 @@ static int _append_geo(int *geometry, List geos, int rotate)
 	list_iterator_destroy(itr);
 
 	if(geo_ptr == NULL) {
-		geo = xmalloc(sizeof(int)*BA_SYSTEM_DIMENSIONS);
+		geo = xmalloc(sizeof(int)*cluster_dims);
 		geo[X] = geometry[X];
 		geo[Y] = geometry[Y];
 		geo[Z] = geometry[Z];
@@ -3366,61 +3257,56 @@ static int _find_yz_path(ba_node_t *ba_node, int *first,
 	return 1;
 }
 
-#endif
-
 #ifndef HAVE_BG_FILES
 /** */
-#ifdef HAVE_3D
 static int _emulate_ext_wiring(ba_node_t ***grid)
-#else
-static int _emulate_ext_wiring(ba_node_t *grid)
-#endif
 {
 	int x;
 	ba_node_t *source = NULL, *target = NULL;
-
-#ifdef HAVE_3D
-	int y,z;
-	init_wires();
-
-	for(x=0;x<DIM_SIZE[X];x++) {
-		for(y=0;y<DIM_SIZE[Y];y++) {
-			for(z=0;z<DIM_SIZE[Z];z++) {
-				source = &grid[x][y][z];
-
-				if(x<(DIM_SIZE[X]-1)) {
-					target = &grid[x+1][y][z];
-				} else
-					target = &grid[0][y][z];
-
-				_set_external_wires(X, x, source,
-						    target);
-
-				if(y<(DIM_SIZE[Y]-1))
-					target = &grid[x][y+1][z];
-				else
-					target = &grid[x][0][z];
-
-				_set_external_wires(Y, y, source,
-						    target);
-				if(z<(DIM_SIZE[Z]-1))
-					target = &grid[x][y][z+1];
-				else
-					target = &grid[x][y][0];
-
-				_set_external_wires(Z, z, source,
-						    target);
+	if(cluster_dims == 1) {
+		for(x=0;x<DIM_SIZE[X];x++) {
+			source = &grid[x][0][0];
+			if(x<(DIM_SIZE[X]-1))
+				target = &grid[x+1][0][0];
+			else
+				target = &grid[0][0][0];
+			_set_external_wires(X, x, source, target);
+		}
+	} else {
+		int y,z;
+		init_wires();
+
+		for(x=0;x<DIM_SIZE[X];x++) {
+			for(y=0;y<DIM_SIZE[Y];y++) {
+				for(z=0;z<DIM_SIZE[Z];z++) {
+					source = &grid[x][y][z];
+
+					if(x<(DIM_SIZE[X]-1)) {
+						target = &grid[x+1][y][z];
+					} else
+						target = &grid[0][y][z];
+
+					_set_external_wires(X, x, source,
+							    target);
+
+					if(y<(DIM_SIZE[Y]-1))
+						target = &grid[x][y+1][z];
+					else
+						target = &grid[x][0][z];
+
+					_set_external_wires(Y, y, source,
+							    target);
+					if(z<(DIM_SIZE[Z]-1))
+						target = &grid[x][y][z+1];
+					else
+						target = &grid[x][y][0];
+
+					_set_external_wires(Z, z, source,
+							    target);
+				}
 			}
 		}
 	}
-#else
-	for(x=0;x<DIM_SIZE[X];x++) {
-		source = &grid[x];
-		target = &grid[x+1];
-		_set_external_wires(X, x, source,
-				    target);
-	}
-#endif
 	return 1;
 }
 #endif
@@ -3498,12 +3384,7 @@ static int _reset_the_path(ba_switch_t *curr_switch, int source,
 		return 0;
 	}
 	next_switch = &ba_system_ptr->
-		grid[node_tar[X]]
-#ifdef HAVE_3D
-		[node_tar[Y]]
-		[node_tar[Z]]
-#endif
-		.axis_switch[dim];
+		grid[node_tar[X]][node_tar[Y]][node_tar[Z]].axis_switch[dim];
 
 	return _reset_the_path(next_switch, port_tar, target, dim);
 //	return 1;
@@ -3518,7 +3399,7 @@ static void _new_ba_node(ba_node_t *ba_node, int *coord, bool track_down_nodes)
 	   && !(ba_node->state & NODE_STATE_DRAIN)) || !track_down_nodes)
 		ba_node->used = false;
 
-	for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){
+	for (i=0; i<cluster_dims; i++){
 		ba_node->coord[i] = coord[i];
 
 		for(j=0;j<NUM_PORTS_PER_NODE;j++) {
@@ -3535,24 +3416,18 @@ static void _new_ba_node(ba_node_t *ba_node, int *coord, bool track_down_nodes)
 
 static void _create_ba_system(void)
 {
-	int x;
-	int coord[BA_SYSTEM_DIMENSIONS];
+	int x,y,z;
+	int coord[cluster_dims];
 
-#ifdef HAVE_3D
-	int y,z;
 	ba_system_ptr->grid = (ba_node_t***)
 		xmalloc(sizeof(ba_node_t**) * DIM_SIZE[X]);
-#else
-	ba_system_ptr->grid = (ba_node_t*)
-		xmalloc(sizeof(ba_node_t) * DIM_SIZE[X]);
-#endif
 	for (x=0; x<DIM_SIZE[X]; x++) {
-#ifdef HAVE_3D
 		ba_system_ptr->grid[x] = (ba_node_t**)
 			xmalloc(sizeof(ba_node_t*) * DIM_SIZE[Y]);
 		for (y=0; y<DIM_SIZE[Y]; y++) {
 			ba_system_ptr->grid[x][y] = (ba_node_t*)
-				xmalloc(sizeof(ba_node_t) * DIM_SIZE[Z]);
+				xmalloc(sizeof(ba_node_t)
+					* DIM_SIZE[Z]);
 			for (z=0; z<DIM_SIZE[Z]; z++){
 				coord[X] = x;
 				coord[Y] = y;
@@ -3561,35 +3436,25 @@ static void _create_ba_system(void)
 					     coord, true);
 			}
 		}
-#else
-		coord[X] = x;
-		_new_ba_node(&ba_system_ptr->grid[x], coord, true);
-#endif
 	}
 }
 
 /** */
 static void _delete_ba_system(void)
 {
-#ifdef HAVE_BG
-	int x=0;
-	int y;
-#endif
+	int x, y;
+
 	if (!ba_system_ptr){
 		return;
 	}
 
 	if(ba_system_ptr->grid) {
-#ifdef HAVE_BG
 		for (x=0; x<DIM_SIZE[X]; x++) {
 			for (y=0; y<DIM_SIZE[Y]; y++)
 				xfree(ba_system_ptr->grid[x][y]);
 
 			xfree(ba_system_ptr->grid[x]);
 		}
-#endif
-
-
 		xfree(ba_system_ptr->grid);
 	}
 	xfree(ba_system_ptr);
@@ -3611,27 +3476,24 @@ static void _delete_path_list(void *object)
 static int _find_match(ba_request_t *ba_request, List results)
 {
 	int x=0;
-#ifdef HAVE_BG
-	int start[BA_SYSTEM_DIMENSIONS] = {0,0,0};
-#else
-	int start[BA_SYSTEM_DIMENSIONS] = {0};
-#endif
+	int start[cluster_dims];
 	ba_node_t *ba_node = NULL;
 	char *name=NULL;
-	int startx = (start[X]-1);
+	int startx;
 	int *geo_ptr;
 
+	if(!(cluster_flags & CLUSTER_FLAG_BG))
+		return 0;
+
+	memset(start, 0, sizeof(start));
+	startx = (start[X]-1);
+
 	if(startx == -1)
 		startx = DIM_SIZE[X]-1;
 	if(ba_request->start_req) {
-		if(ba_request->start[X]>=DIM_SIZE[X]
-#ifdef HAVE_BG
-		   || ba_request->start[Y]>=DIM_SIZE[Y]
-		   || ba_request->start[Z]>=DIM_SIZE[Z]
-#endif
-			)
-			return 0;
-		for(x=0;x<BA_SYSTEM_DIMENSIONS;x++) {
+		for(x=0;x<cluster_dims;x++) {
+			if(ba_request->start[x]>=DIM_SIZE[x])
+				return 0;
 			start[x] = ba_request->start[x];
 		}
 	}
@@ -3647,19 +3509,12 @@ static int _find_match(ba_request_t *ba_request, List results)
 	ba_request->geometry[Z] = geo_ptr[Z];
 
 	if(ba_request->geometry[X]>DIM_SIZE[X]
-#ifdef HAVE_3D
 	   || ba_request->geometry[Y]>DIM_SIZE[Y]
-	   || ba_request->geometry[Z]>DIM_SIZE[Z]
-#endif
-		)
-#ifdef HAVE_BG
+	   || ba_request->geometry[Z]>DIM_SIZE[Z])
 		if(!_check_for_options(ba_request))
-#endif
 			return 0;
 
-#ifdef HAVE_BG
 start_again:
-#endif
 	x=0;
 	if(x == startx)
 		x = startx-1;
@@ -3667,29 +3522,16 @@ start_again:
 		x++;
 		debug4("finding %c%c%c try %d",
 		       alpha_num[ba_request->geometry[X]],
-#ifdef HAVE_3D
 		       alpha_num[ba_request->geometry[Y]],
 		       alpha_num[ba_request->geometry[Z]],
-#endif
 		       x);
-#ifdef HAVE_3D
 	new_node:
-#endif
 		debug3("starting at %c%c%c",
-		       alpha_num[start[X]]
-#ifdef HAVE_3D
-		       , alpha_num[start[Y]],
-		       alpha_num[start[Z]]
-#endif
-			);
+		       alpha_num[start[X]],
+		       alpha_num[start[Y]],
+		       alpha_num[start[Z]]);
 
-		ba_node = &ba_system_ptr->
-			grid[start[X]]
-#ifdef HAVE_3D
-			[start[Y]]
-			[start[Z]]
-#endif
-			;
+		ba_node = &ba_system_ptr->grid[start[X]][start[Y]][start[Z]];
 
 		if (!_node_used(ba_node, ba_request->geometry[X])) {
 			debug4("trying this node %c%c%c %c%c%c %d",
@@ -3723,8 +3565,6 @@ start_again:
 
 		}
 
-#ifdef HAVE_3D
-
 		if((DIM_SIZE[Z]-start[Z]-1)
 		   >= ba_request->geometry[Z])
 			start[Z]++;
@@ -3741,7 +3581,6 @@ start_again:
 				else {
 					if(ba_request->size == 1)
 						goto requested_end;
-#ifdef HAVE_BG
 					if(!_check_for_options(ba_request))
 						return 0;
 					else {
@@ -3750,14 +3589,10 @@ start_again:
 						start[Z]=0;
 						goto start_again;
 					}
-#else
-					return 0;
-#endif
 				}
 			}
 		}
 		goto new_node;
-#endif
 	}
 requested_end:
 	debug2("1 can't allocate");
@@ -3823,7 +3658,7 @@ static void _switch_config(ba_node_t* source, ba_node_t* target, int dim,
 
 	config = &source->axis_switch[dim];
 	config_tar = &target->axis_switch[dim];
-	for(i=0;i<BA_SYSTEM_DIMENSIONS;i++) {
+	for(i=0;i<cluster_dims;i++) {
 		/* Set the coord of the source target node to the target */
 		config->ext_wire[port_src].node_tar[i] = target->coord[i];
 
@@ -3841,6 +3676,7 @@ static void _switch_config(ba_node_t* source, ba_node_t* target, int dim,
 static int _set_external_wires(int dim, int count, ba_node_t* source,
 			       ba_node_t* target)
 {
+
 #ifdef HAVE_BG_FILES
 #ifdef HAVE_BGL
 
@@ -3866,6 +3702,10 @@ static int _set_external_wires(int dim, int count, ba_node_t* source,
 	char from_node[NODE_LEN];
 	char to_node[NODE_LEN];
 
+	if(working_cluster_rec) {
+		error("Can't do this cross-cluster");
+		return -1;
+	}
 	if (!have_db2) {
 		error("Can't access DB2 library, run from service node");
 		return -1;
@@ -3996,7 +3836,6 @@ static int _set_external_wires(int dim, int count, ba_node_t* source,
 		       _port_enum(to_port));
 	}
 #else
-
 	_switch_config(source, source, dim, 0, 0);
 	_switch_config(source, source, dim, 1, 1);
 	if(dim!=X) {
@@ -4006,7 +3845,18 @@ static int _set_external_wires(int dim, int count, ba_node_t* source,
 		return 1;
 	}
 
-#ifdef HAVE_BG
+	if(cluster_dims == 1) {
+		if(count == 0)
+			_switch_config(source, source, dim, 5, 5);
+		else if(count < DIM_SIZE[X]-1)
+			_switch_config(source, target, dim, 2, 5);
+		else
+			_switch_config(source, source, dim, 2, 2);
+		_switch_config(source, source, dim, 3, 3);
+		_switch_config(source, source, dim, 4, 4);
+		return 1;
+	}
+
 	/* set up x */
 	/* always 2->5 of next. If it is the last it will go to the first.*/
 	_switch_config(source, target, dim, 2, 5);
@@ -4243,17 +4093,7 @@ static int _set_external_wires(int dim, int count, ba_node_t* source,
 		fatal("We don't have a config to do a BG system with %d "
 		      "in the X-dim.", DIM_SIZE[X]);
 	}
-#else
-	if(count == 0)
-		_switch_config(source, source, dim, 5, 5);
-	else if(count < DIM_SIZE[X]-1)
-		_switch_config(source, target, dim, 2, 5);
-	else
-		_switch_config(source, source, dim, 2, 2);
-	_switch_config(source, source, dim, 3, 3);
-	_switch_config(source, source, dim, 4, 4);
-#endif /* HAVE_BG */
-#endif /* HAVE_BG_FILES */
+#endif
 	return 1;
 }
 
@@ -4459,11 +4299,8 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 
 		broke_it:
 			next_node = &ba_system_ptr->grid[node_tar[X]]
-#ifdef HAVE_3D
 				[node_tar[Y]]
-				[node_tar[Z]]
-#endif
-				;
+				[node_tar[Z]];
 			next_switch = &next_node->axis_switch[X];
 
  			if((conn_type == SELECT_MESH) && (found == (x_size))) {
@@ -4513,7 +4350,6 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 			}
 
 			if (!_node_used(next_node, x_size)) {
-#ifdef HAVE_BG
 				debug3("Algo(%d) found %d looking at %c%c%c "
 				       "%d going to %c%c%c %d",
 				       algo,
@@ -4526,7 +4362,6 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 				       alpha_num[node_tar[Y]],
 				       alpha_num[node_tar[Z]],
 				       port_tar);
-#endif
 				itr = list_iterator_create(results);
 				while((check_node = list_next(itr))) {
 					if((node_tar[X] == check_node->coord[X]
@@ -4539,23 +4374,19 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 				}
 				list_iterator_destroy(itr);
 				if(!check_node) {
-#ifdef HAVE_BG
 					debug3("Algo(%d) add %c%c%c",
 					       algo,
 					       alpha_num[next_node->coord[X]],
 					       alpha_num[next_node->coord[Y]],
 					       alpha_num[next_node->coord[Z]]);
-#endif
 					list_append(results, next_node);
 				} else {
-#ifdef HAVE_BG
 					debug3("Algo(%d) Hey this is already "
 					       "added %c%c%c",
 					       algo,
 					       alpha_num[node_tar[X]],
 					       alpha_num[node_tar[Y]],
 					       alpha_num[node_tar[Z]]);
-#endif
 					continue;
 				}
 				found++;
@@ -4569,7 +4400,6 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 					continue;
 				} else {
 				found_path:
-#ifdef HAVE_BG
 					debug3("Algo(%d) added node %c%c%c "
 					       "%d %d -> %c%c%c %d %d",
 					       algo,
@@ -4583,7 +4413,6 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 					       alpha_num[node_tar[Z]],
 					       port_tar,
 					       target_port);
-#endif
 					curr_switch->int_wire[source_port].used
 						= 1;
 					curr_switch->int_wire
@@ -4614,14 +4443,12 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 		debug3("Algo(%d) couldn't find path", algo);
 		return 0;
 	} else if(algo == BLOCK_ALGO_SECOND) {
-#ifdef HAVE_BG
 		debug3("Algo(%d) looking for the next free node "
 		       "starting at %c%c%c",
 		       algo,
 		       alpha_num[ba_node->coord[X]],
 		       alpha_num[ba_node->coord[Y]],
 		       alpha_num[ba_node->coord[Z]]);
-#endif
 
 		if(best_path)
 			list_flush(best_path);
@@ -4647,15 +4474,11 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 			}
 
 			next_node = &ba_system_ptr->grid[node_tar[X]]
-#ifdef HAVE_3D
 				[node_tar[Y]]
-				[node_tar[Z]]
-#endif
-				;
+				[node_tar[Z]];
 
 			next_switch = &next_node->axis_switch[X];
 
-#ifdef HAVE_BG
 			debug3("Algo(%d) found %d looking at %c%c%c "
 			       "going to %c%c%c %d",
 			       algo, found,
@@ -4666,7 +4489,7 @@ static int _find_x_path(List results, ba_node_t *ba_node,
 			       alpha_num[node_tar[Y]],
 			       alpha_num[node_tar[Z]],
 			       port_tar);
-#endif
+
 			list_append(results, next_node);
 			found++;
 			if(_find_x_path(results, next_node,
@@ -4759,14 +4582,9 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 
 	itr = list_iterator_create(nodes);
 	while((ba_node = (ba_node_t*) list_next(itr))) {
-
 		if(node_tar[X] == ba_node->coord[X]
-#ifdef HAVE_3D
 		   && node_tar[Y] == ba_node->coord[Y]
-		   && node_tar[Z] == ba_node->coord[Z]
-#endif
-			)
-		{
+		   && node_tar[Z] == ba_node->coord[Z]) {
 			broke = 1;
 			break;
 		}
@@ -4774,19 +4592,11 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 	list_iterator_destroy(itr);
 
 	if(!broke && count>0 &&
-	   !ba_system_ptr->grid[node_tar[X]]
-#ifdef HAVE_3D
-	   [node_tar[Y]]
-	   [node_tar[Z]]
-#endif
-	   .used) {
-
-#ifdef HAVE_BG
+	   !ba_system_ptr->grid[node_tar[X]][node_tar[Y]][node_tar[Z]].used) {
 		debug3("this one not found %c%c%c",
 		       alpha_num[node_tar[X]],
 		       alpha_num[node_tar[Y]],
 		       alpha_num[node_tar[Z]]);
-#endif
 		broke = 0;
 
 		if((source_port%2))
@@ -4805,10 +4615,8 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 				xmalloc(sizeof(ba_path_switch_t));
 
 			temp_switch->geometry[X] = path_switch->geometry[X];
-#ifdef HAVE_BG
 			temp_switch->geometry[Y] = path_switch->geometry[Y];
 			temp_switch->geometry[Z] = path_switch->geometry[Z];
-#endif
 			temp_switch->dim = path_switch->dim;
 			temp_switch->in = path_switch->in;
 			temp_switch->out = path_switch->out;
@@ -4826,14 +4634,8 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 		       (ba_path_switch_t*) list_next(itr))){
 
 			if(((path_switch->geometry[X] == node_src[X])
-#ifdef HAVE_BG
-			    && (path_switch->geometry[Y]
-				== node_src[Y])
-			    && (path_switch->geometry[Z]
-				== node_tar[Z])
-#endif
-				   )) {
-
+			    && (path_switch->geometry[Y] == node_src[Y])
+			    && (path_switch->geometry[Z] == node_tar[Z]))) {
 				if( path_switch->out
 				    == port_to_try) {
 					used = 1;
@@ -4847,15 +4649,10 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 		if(curr_switch->
 		   ext_wire[port_to_try].node_tar[X]
 		   == curr_switch->ext_wire[0].node_tar[X]
-#ifdef HAVE_3D
-		   && curr_switch->
-		   ext_wire[port_to_try].node_tar[Y]
+		   && curr_switch->ext_wire[port_to_try].node_tar[Y]
 		   == curr_switch->ext_wire[0].node_tar[Y]
-		   && curr_switch->
-		   ext_wire[port_to_try].node_tar[Z]
-		   == curr_switch->ext_wire[0].node_tar[Z]
-#endif
-			) {
+		   && curr_switch->ext_wire[port_to_try].node_tar[Z]
+		   == curr_switch->ext_wire[0].node_tar[Z]) {
 			used = 1;
 		}
 
@@ -4866,11 +4663,7 @@ static int _find_next_free_using_port_2(ba_switch_t *curr_switch,
 				ext_wire[port_to_try].node_tar;
 
 			next_switch = &ba_system_ptr->
-				grid[node_tar[X]]
-#ifdef HAVE_3D
-				[node_tar[Y]]
-				[node_tar[Z]]
-#endif
+				grid[node_tar[X]][node_tar[Y]][node_tar[Z]]
 				.axis_switch[X];
 
 			count++;
@@ -4926,10 +4719,9 @@ static int _finish_torus(List results,
 	static bool found = false;
 
 	path_add->geometry[X] = node_src[X];
-#ifdef HAVE_BG
 	path_add->geometry[Y] = node_src[Y];
 	path_add->geometry[Z] = node_src[Z];
-#endif
+
 	path_add->dim = dim;
 	path_add->in = source_port;
 
@@ -4938,11 +4730,8 @@ static int _finish_torus(List results,
 		return 0;
 	}
 	if(node_tar[X] == start[X]
-#ifdef HAVE_BG
-	    && node_tar[Y] == start[Y]
-	    && node_tar[Z] == start[Z]
-#endif
-		) {
+	   && node_tar[Y] == start[Y]
+	   && node_tar[Z] == start[Z]) {
 
 		if((source_port%2))
 			target_port=1;
@@ -4956,17 +4745,15 @@ static int _finish_torus(List results,
 
 			itr = list_iterator_create(path);
 			while((path_switch = list_next(itr))) {
-
 				temp_switch = xmalloc(sizeof(ba_path_switch_t));
 
 				temp_switch->geometry[X] =
 					path_switch->geometry[X];
-#ifdef HAVE_BG
 				temp_switch->geometry[Y] =
 					path_switch->geometry[Y];
 				temp_switch->geometry[Z] =
 					path_switch->geometry[Z];
-#endif
+
 				temp_switch->dim = path_switch->dim;
 				temp_switch->in = path_switch->in;
 				temp_switch->out = path_switch->out;
@@ -4990,13 +4777,9 @@ static int _finish_torus(List results,
 			while((path_switch = list_next(itr))){
 
 				if(((path_switch->geometry[X] == node_src[X])
-#ifdef HAVE_BG
-				    && (path_switch->geometry[Y]
-					== node_src[Y])
+				    && (path_switch->geometry[Y] == node_src[Y])
 				    && (path_switch->geometry[Z]
-					== node_tar[Z])
-#endif
-					)) {
+					== node_tar[Z]))) {
 					if( path_switch->out
 					    == ports_to_try[i]) {
 						used = 1;
@@ -5062,11 +4845,8 @@ static int _finish_torus(List results,
 					continue;
 				}
 
-				next_switch = &ba_system_ptr->grid[node_tar[X]]
-#ifdef HAVE_3D
-					[node_tar[Y]]
-					[node_tar[Z]]
-#endif
+				next_switch = &ba_system_ptr->grid
+					[node_tar[X]][node_tar[Y]][node_tar[Z]]
 					.axis_switch[dim];
 
 
@@ -5109,7 +4889,6 @@ static int *_set_best_path()
 			*deny_pass |= PASS_FOUND_X;
 			debug2("got a passthrough in X");
 		}
-#ifdef HAVE_3D
 		debug4("mapping %c%c%c %d->%d",
 		       alpha_num[path_switch->geometry[X]],
 		       alpha_num[path_switch->geometry[Y]],
@@ -5122,10 +4901,6 @@ static int *_set_best_path()
 			[path_switch->geometry[Y]]
 			[path_switch->geometry[Z]].
 			axis_switch[path_switch->dim];
-#else
-		curr_switch = &ba_system_ptr->grid[path_switch->geometry[X]].
-			axis_switch[path_switch->dim];
-#endif
 
 		curr_switch->int_wire[path_switch->in].used = 1;
 		curr_switch->int_wire[path_switch->in].port_tar =
@@ -5145,14 +4920,10 @@ static int _set_one_dim(int *start, int *end, int *coord)
 	int dim;
 	ba_switch_t *curr_switch = NULL;
 
-	for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) {
+	for(dim=0;dim<cluster_dims;dim++) {
 		if(start[dim]==end[dim]) {
-			curr_switch = &ba_system_ptr->grid[coord[X]]
-#ifdef HAVE_3D
-				[coord[Y]]
-				[coord[Z]]
-#endif
-				.axis_switch[dim];
+			curr_switch = &ba_system_ptr->grid
+				[coord[X]][coord[Y]][coord[Z]].axis_switch[dim];
 
 			if(!curr_switch->int_wire[0].used
 			   && !curr_switch->int_wire[1].used) {
diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.h b/src/plugins/select/bluegene/block_allocator/block_allocator.h
index b5af1bf23aa53e089a48ec9d60fc873aa06e60bc..01801d484c9321561d77bf802df9ad3eb325dff6 100644
--- a/src/plugins/select/bluegene/block_allocator/block_allocator.h
+++ b/src/plugins/select/bluegene/block_allocator/block_allocator.h
@@ -47,12 +47,6 @@
 
 #define NUM_PORTS_PER_NODE 6
 
-#ifdef HAVE_3D
-#define BA_SYSTEM_DIMENSIONS 3
-#else
-#define BA_SYSTEM_DIMENSIONS 1
-#endif
-
 #define PASS_DENY_X 0x0001
 #define PASS_DENY_Y 0x0002
 #define PASS_DENY_Z 0x0004
@@ -81,7 +75,7 @@ enum {X, Y, Z};
  */
 typedef struct {
 	int dim;
-	int geometry[BA_SYSTEM_DIMENSIONS];
+	int geometry[HIGHEST_DIMENSIONS];
 	int in;
 	int out;
 } ba_path_switch_t;
@@ -100,7 +94,7 @@ typedef struct {
 					  we are at */
 	List elongate_geos;            /* list of possible shapes of
 					  blocks. contains int* ptrs */
-	int geometry[BA_SYSTEM_DIMENSIONS]; /* size of block in geometry */
+	int geometry[HIGHEST_DIMENSIONS]; /* size of block in geometry */
 	char *linuximage;              /* LinuxImage for this block */
 	char *mloaderimage;            /* mloaderImage for this block */
 	uint16_t deny_pass;            /* PASSTHROUGH_FOUND is set if there are
@@ -132,7 +126,7 @@ typedef struct {
 					* block, only used for small
 					* block creation */
 #endif
-	int start[BA_SYSTEM_DIMENSIONS]; /* where to start creation of
+	int start[HIGHEST_DIMENSIONS]; /* where to start creation of
 					    block */
 	int start_req;                 /* state there was a start
 					  request */
@@ -200,7 +194,7 @@ typedef struct {
 typedef struct
 {
 	/* target label */
-	int node_tar[BA_SYSTEM_DIMENSIONS];
+	int node_tar[HIGHEST_DIMENSIONS];
 	/* target port */
 	int port_tar;
 	bool used;
@@ -226,9 +220,9 @@ typedef struct
  */
 typedef struct {
 	/* a switch for each dimensions */
-	ba_switch_t axis_switch[BA_SYSTEM_DIMENSIONS];
+	ba_switch_t axis_switch[HIGHEST_DIMENSIONS];
 	/* coordinates of midplane */
-	int coord[BA_SYSTEM_DIMENSIONS];
+	int coord[HIGHEST_DIMENSIONS];
 	/* color of letter used in smap */
 	int color;
 	/* midplane index used for easy look up of the miplane */
@@ -247,11 +241,7 @@ typedef struct {
 
 	/* made to hold info about a system, which right now is only a
 	 * grid of ba_nodes*/
-#ifdef HAVE_3D
 	ba_node_t ***grid;
-#else
-	ba_node_t *grid;
-#endif
 } ba_system_t;
 
 /* Used to Keep track of where the Base Blocks are at all times
@@ -259,7 +249,7 @@ typedef struct {
 */
 typedef struct {
 	char *bp_id;
-	int coord[BA_SYSTEM_DIMENSIONS];
+	int coord[HIGHEST_DIMENSIONS];
 } ba_bp_map_t;
 
 /* Global */
@@ -268,8 +258,8 @@ extern List bp_map_list; /* list used for conversion from XYZ to Rack
 			  * midplane */
 extern char letters[62]; /* complete list of letters used in smap */
 extern char colors[6]; /* index into colors used for smap */
-extern int DIM_SIZE[BA_SYSTEM_DIMENSIONS]; /* how many midplanes in
-					    * each dimension */
+extern int DIM_SIZE[HIGHEST_DIMENSIONS]; /* how many midplanes in
+					  * each dimension */
 extern s_p_options_t bg_conf_file_options[]; /* used to parse the
 					      * bluegene.conf file. */
 extern uint16_t ba_deny_pass;
diff --git a/src/plugins/select/bluegene/plugin/bg_job_place.c b/src/plugins/select/bluegene/plugin/bg_job_place.c
index de2d5022dffd7c788ac51b61e380480446b435d8..a5e50b40a2bc942d949ef29aac1168071830b2c2 100644
--- a/src/plugins/select/bluegene/plugin/bg_job_place.c
+++ b/src/plugins/select/bluegene/plugin/bg_job_place.c
@@ -660,9 +660,9 @@ static int _dynamically_request(List block_list, int *blocks_added,
 	ListIterator itr = NULL;
 	int rc = SLURM_ERROR;
 	int create_try = 0;
-	int start_geo[BA_SYSTEM_DIMENSIONS];
+	int start_geo[SYSTEM_DIMENSIONS];
 
-	memcpy(start_geo, request->geometry, sizeof(int)*BA_SYSTEM_DIMENSIONS);
+	memcpy(start_geo, request->geometry, sizeof(int)*SYSTEM_DIMENSIONS);
 	debug2("going to create %d", request->size);
 	list_of_lists = list_create(NULL);
 
@@ -725,7 +725,7 @@ static int _dynamically_request(List block_list, int *blocks_added,
 			list_destroy(new_blocks);
 			if(!*blocks_added) {
 				memcpy(request->geometry, start_geo,
-				       sizeof(int)*BA_SYSTEM_DIMENSIONS);
+				       sizeof(int)*SYSTEM_DIMENSIONS);
 				rc = SLURM_ERROR;
 				continue;
 			}
@@ -740,7 +740,7 @@ static int _dynamically_request(List block_list, int *blocks_added,
 		}
 
 		memcpy(request->geometry, start_geo,
-		       sizeof(int)*BA_SYSTEM_DIMENSIONS);
+		       sizeof(int)*SYSTEM_DIMENSIONS);
 
 	}
 	list_iterator_destroy(itr);
@@ -768,7 +768,7 @@ static int _find_best_block_match(List block_list,
 				  uint16_t query_mode, int avail_cpus)
 {
 	bg_record_t *bg_record = NULL;
-	uint16_t req_geometry[BA_SYSTEM_DIMENSIONS];
+	uint16_t req_geometry[SYSTEM_DIMENSIONS];
 	uint16_t conn_type, rotate, target_size = 0;
 	uint32_t req_procs = job_ptr->details->min_cpus;
 	ba_request_t request;
@@ -830,7 +830,7 @@ static int _find_best_block_match(List block_list,
 
 	if(req_geometry[X] != 0 && req_geometry[X] != (uint16_t)NO_VAL) {
 		target_size = 1;
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+		for (i=0; i<SYSTEM_DIMENSIONS; i++)
 			target_size *= (uint16_t)req_geometry[i];
 		if(target_size != min_nodes) {
 			debug2("min_nodes not set correctly %u should be %u "
@@ -853,7 +853,7 @@ static int _find_best_block_match(List block_list,
 
 	memset(&request, 0, sizeof(ba_request_t));
 
-	for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+	for(i=0; i<SYSTEM_DIMENSIONS; i++)
 		request.geometry[i] = req_geometry[i];
 
 	request.deny_pass = (uint16_t)NO_VAL;
@@ -957,7 +957,7 @@ static int _find_best_block_match(List block_list,
 		} else {
 			/* this gets altered in _find_matching_block so we
 			   reset it */
-			for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+			for(i=0; i<SYSTEM_DIMENSIONS; i++)
 				request.geometry[i] = req_geometry[i];
 		}
 
@@ -1031,7 +1031,7 @@ static int _find_best_block_match(List block_list,
 				bool track_down_nodes = true;
 				/* this gets altered in
 				 * create_dynamic_block so we reset it */
-				for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+				for(i=0; i<SYSTEM_DIMENSIONS; i++)
 					request.geometry[i] = req_geometry[i];
 
 				if((bg_record = list_pop(job_list))) {
diff --git a/src/plugins/select/bluegene/plugin/bg_record_functions.c b/src/plugins/select/bluegene/plugin/bg_record_functions.c
index 96195bc3cb1429baac85489fd01660ac364a2238..48f2033963972bbb2c38838bd72f4d7c95029f01 100644
--- a/src/plugins/select/bluegene/plugin/bg_record_functions.c
+++ b/src/plugins/select/bluegene/plugin/bg_record_functions.c
@@ -173,12 +173,13 @@ extern void process_nodes(bg_record_t *bg_record, bool startup)
 	int j=0, number;
 	int diff=0;
 	int largest_diff=-1;
-	int best_start[BA_SYSTEM_DIMENSIONS];
-	int start[BA_SYSTEM_DIMENSIONS];
-	int end[BA_SYSTEM_DIMENSIONS];
+	int best_start[SYSTEM_DIMENSIONS];
+	int start[SYSTEM_DIMENSIONS];
+	int end[SYSTEM_DIMENSIONS];
 	bool start_set=0;
 	ListIterator itr;
 	ba_node_t* ba_node = NULL;
+	char *p = '\0';
 
 	if(!bg_record->bg_block_list
 	   || !list_count(bg_record->bg_block_list)) {
@@ -201,24 +202,17 @@ extern void process_nodes(bg_record_t *bg_record, bool startup)
 			    && (bg_record->nodes[j+4] == 'x'
 				|| bg_record->nodes[j+4] == '-')) {
 				j++;
-				number = xstrntol(bg_record->nodes + j,
-						  NULL, BA_SYSTEM_DIMENSIONS,
-						  HOSTLIST_BASE);
-				start[X] = number /
-					(HOSTLIST_BASE * HOSTLIST_BASE);
-				start[Y] = (number %
-					    (HOSTLIST_BASE * HOSTLIST_BASE))
-					/ HOSTLIST_BASE;
-				start[Z] = (number % HOSTLIST_BASE);
+				number = strtoul(bg_record->nodes + j,
+						 &p, HOSTLIST_BASE);
+				hostlist_parse_int_to_array(
+					number, start, SYSTEM_DIMENSIONS,
+					HOSTLIST_BASE);
 				j += 4;
-				number = xstrntol(bg_record->nodes + j,
-						NULL, 3, HOSTLIST_BASE);
-				end[X] = number /
-					(HOSTLIST_BASE * HOSTLIST_BASE);
-				end[Y] = (number
-					  % (HOSTLIST_BASE * HOSTLIST_BASE))
-					/ HOSTLIST_BASE;
-				end[Z] = (number % HOSTLIST_BASE);
+				number = strtoul(bg_record->nodes + j,
+						 &p, HOSTLIST_BASE);
+				hostlist_parse_int_to_array(
+					number, end, SYSTEM_DIMENSIONS,
+					HOSTLIST_BASE);
 				j += 3;
 				diff = end[X]-start[X];
 				if(diff > largest_diff) {
@@ -244,15 +238,11 @@ extern void process_nodes(bg_record_t *bg_record, bool startup)
 				  || (bg_record->nodes[j] >= 'A'
 				      && bg_record->nodes[j] <= 'Z')) {
 
-				number = xstrntol(bg_record->nodes + j,
-						  NULL, BA_SYSTEM_DIMENSIONS,
-						  HOSTLIST_BASE);
-				start[X] = number /
-					(HOSTLIST_BASE * HOSTLIST_BASE);
-				start[Y] = (number %
-					    (HOSTLIST_BASE * HOSTLIST_BASE))
-					/ HOSTLIST_BASE;
-				start[Z] = (number % HOSTLIST_BASE);
+				number = strtoul(bg_record->nodes + j,
+						 &p, HOSTLIST_BASE);
+				hostlist_parse_int_to_array(
+					number, start, SYSTEM_DIMENSIONS,
+					HOSTLIST_BASE);
 				j+=3;
 				diff = 0;
 				if(diff > largest_diff) {
@@ -446,7 +436,7 @@ extern void copy_bg_record(bg_record_t *fir_record, bg_record_t *sec_record)
 	sec_record->boot_count = fir_record->boot_count;
 	sec_record->full_block = fir_record->full_block;
 
-	for(i=0;i<BA_SYSTEM_DIMENSIONS;i++) {
+	for(i=0;i<SYSTEM_DIMENSIONS;i++) {
 		sec_record->geo[i] = fir_record->geo[i];
 		sec_record->start[i] = fir_record->start[i];
 	}
diff --git a/src/plugins/select/bluegene/plugin/bg_record_functions.h b/src/plugins/select/bluegene/plugin/bg_record_functions.h
index 45e2b2a9dba51e42735a55cd0ff0533293b8b230..88246027447c7557da42f0716f410bc57184ef5b 100644
--- a/src/plugins/select/bluegene/plugin/bg_record_functions.h
+++ b/src/plugins/select/bluegene/plugin/bg_record_functions.h
@@ -77,7 +77,7 @@ typedef struct bg_record {
 	uint32_t cpu_cnt;               /* count of cpus per block */
 	int full_block;                 /* whether or not block is the full
 					   block */
-	uint16_t geo[BA_SYSTEM_DIMENSIONS];  /* geometry */
+	uint16_t geo[HIGHEST_DIMENSIONS];  /* geometry */
 	char *ionodes; 		        /* String of ionodes in block
 					 * NULL if not a small block*/
 	struct job_record *job_ptr;	/* pointer to job running on
@@ -104,7 +104,7 @@ typedef struct bg_record {
 	char *ramdiskimage;             /* RamDiskImage/IoloadImg for
 					 * this block */
 	rm_partition_state_t state;     /* Current state of the block */
-	int start[BA_SYSTEM_DIMENSIONS];/* start node */
+	int start[HIGHEST_DIMENSIONS];  /* start node */
 	int switch_count;               /* number of switches used. */
 	char *target_name;		/* when a block is freed this
 					   is the name of the user we
diff --git a/src/plugins/select/bluegene/plugin/bg_switch_connections.c b/src/plugins/select/bluegene/plugin/bg_switch_connections.c
index 363ae504b92189bd5d9b0a4f1a217274ad73526c..69d814f603dd4631ff46c1ba0f52fb05ccab9c94 100644
--- a/src/plugins/select/bluegene/plugin/bg_switch_connections.c
+++ b/src/plugins/select/bluegene/plugin/bg_switch_connections.c
@@ -109,7 +109,7 @@ static int _get_bp_by_location(my_bluegene_t* my_bg, int* curr_coord,
 
 static int _get_switches_by_bpid(
 	my_bluegene_t* my_bg, const char *bpid,
-	rm_switch_t *coord_switch[BA_SYSTEM_DIMENSIONS])
+	rm_switch_t *coord_switch[SYSTEM_DIMENSIONS])
 {
 	static int switch_num = 0;
 	rm_switch_t *curr_switch = NULL;
@@ -158,7 +158,7 @@ static int _get_switches_by_bpid(
 		if (!strcasecmp((char *)bpid, (char *)curr_bpid)) {
 			coord_switch[found_bpid] = curr_switch;
 			found_bpid++;
-			if(found_bpid==BA_SYSTEM_DIMENSIONS) {
+			if(found_bpid==SYSTEM_DIMENSIONS) {
 				free(curr_bpid);
 				return SLURM_SUCCESS;
 			}
@@ -292,7 +292,7 @@ static int _used_switches(ba_node_t* ba_node)
 	       alpha_num[ba_node->coord[X]],
 	       alpha_num[ba_node->coord[Y]],
 	       alpha_num[ba_node->coord[Z]]);
-	for(i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
+	for(i=0; i<SYSTEM_DIMENSIONS; i++) {
 		debug5("dim %d", i);
 		ba_switch = &ba_node->axis_switch[i];
 		for(j=0; j<num_connections; j++) {
@@ -649,7 +649,7 @@ extern int configure_block_switches(bg_record_t * bg_record)
 	int first_switch=1;
 	int i = 0;
 	rm_BP_t *curr_bp = NULL;
-	rm_switch_t *coord_switch[BA_SYSTEM_DIMENSIONS];
+	rm_switch_t *coord_switch[SYSTEM_DIMENSIONS];
 #endif
 	if(!bg_record->bg_block_list) {
 		error("There was no block_list given, can't create block");
@@ -754,7 +754,7 @@ extern int configure_block_switches(bg_record_t * bg_record)
 			continue;
 		}
 		free(bpid);
-		for(i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
+		for(i=0; i<SYSTEM_DIMENSIONS; i++) {
 			if(_add_switch_conns(coord_switch[i],
 					     &ba_node->axis_switch[i])
 			   == SLURM_SUCCESS) {
diff --git a/src/plugins/select/bluegene/plugin/block_sys.c b/src/plugins/select/bluegene/plugin/block_sys.c
index c844d5bf23f1d50d9110e8f4b5b1e826253d07a3..fde79dbf66056f6f4af6f1a04cac6054839167a1 100755
--- a/src/plugins/select/bluegene/plugin/block_sys.c
+++ b/src/plugins/select/bluegene/plugin/block_sys.c
@@ -956,7 +956,7 @@ extern int load_state_file(List curr_block_list, char *dir_name)
 	bg_record_t *bg_record = NULL;
 	block_info_t *block_info = NULL;
 	bitstr_t *node_bitmap = NULL, *ionode_bitmap = NULL;
-	int geo[BA_SYSTEM_DIMENSIONS];
+	int geo[SYSTEM_DIMENSIONS];
 	char temp[256];
 	List results = NULL;
 	int data_allocated, data_read = 0;
@@ -1186,7 +1186,7 @@ extern int load_state_file(List curr_block_list, char *dir_name)
 		bg_record->ramdiskimage =
 			xstrdup(block_info->ramdiskimage);
 
-		for(j=0; j<BA_SYSTEM_DIMENSIONS; j++)
+		for(j=0; j<SYSTEM_DIMENSIONS; j++)
 			geo[j] = bg_record->geo[j];
 
 		if((bg_conf->layout_mode == LAYOUT_OVERLAP)
diff --git a/src/plugins/select/bluegene/plugin/bluegene.c b/src/plugins/select/bluegene/plugin/bluegene.c
index 0e18443e12b061fd72da043f84bc0ed88f84323c..4650e12fd3bbcb0d09835978e1cfae01847e1bdf 100644
--- a/src/plugins/select/bluegene/plugin/bluegene.c
+++ b/src/plugins/select/bluegene/plugin/bluegene.c
@@ -69,10 +69,10 @@ int free_cnt = 0;
 int destroy_cnt = 0;
 
 #ifndef HAVE_BG_FILES
-# if BA_SYSTEM_DIMENSIONS==3
-int max_dim[BA_SYSTEM_DIMENSIONS] = { 0, 0, 0 };
+# if SYSTEM_DIMENSIONS==3
+int max_dim[SYSTEM_DIMENSIONS] = { 0, 0, 0 };
 # else
-int max_dim[BA_SYSTEM_DIMENSIONS] = { 0 };
+int max_dim[SYSTEM_DIMENSIONS] = { 0 };
 # endif
 #endif
 
diff --git a/src/plugins/select/bluegene/plugin/defined_block.c b/src/plugins/select/bluegene/plugin/defined_block.c
index 6370e7b37ae13f8325de57e729b104810fb9948e..cad457420cfa2cc9ce67530ac74ce2f3e4b341fe 100644
--- a/src/plugins/select/bluegene/plugin/defined_block.c
+++ b/src/plugins/select/bluegene/plugin/defined_block.c
@@ -57,7 +57,7 @@ extern int create_defined_blocks(bg_layout_t overlapped,
 	ListIterator itr_found;
 	int i;
 	bg_record_t *found_record = NULL;
-	int geo[BA_SYSTEM_DIMENSIONS];
+	int geo[SYSTEM_DIMENSIONS];
 	char temp[256];
 	List results = NULL;
 	struct part_record *part_ptr = NULL;
@@ -146,7 +146,7 @@ extern int create_defined_blocks(bg_layout_t overlapped,
 					      "bluegene.conf file?",
 					      bg_record->bg_block_id);
 
-				for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+				for(i=0; i<SYSTEM_DIMENSIONS; i++)
 					geo[i] = bg_record->geo[i];
 				debug2("adding %s %c%c%c %c%c%c",
 				       bg_record->nodes,
@@ -287,7 +287,7 @@ extern int create_full_system_block(List bg_found_block_list)
 	bg_record_t *bg_record = NULL;
 	char *name = NULL;
 	List records = NULL;
-	int geo[BA_SYSTEM_DIMENSIONS];
+	int geo[SYSTEM_DIMENSIONS];
 	int i;
 	blockreq_t blockreq;
 	List results = NULL;
@@ -395,7 +395,7 @@ extern int create_full_system_block(List bg_found_block_list)
 		goto no_total;
 	}
 	reset_ba_system(false);
-	for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+	for(i=0; i<SYSTEM_DIMENSIONS; i++)
 		geo[i] = bg_record->geo[i];
 	debug2("adding %s %c%c%c %c%c%c",
 	       bg_record->nodes,
diff --git a/src/plugins/select/bluegene/plugin/dynamic_block.c b/src/plugins/select/bluegene/plugin/dynamic_block.c
index ff6c65e0a304b744fe5313a49c6d0842e4b21d2a..aeee4c9aed5c126ff083929f8e2b7d198e813945 100644
--- a/src/plugins/select/bluegene/plugin/dynamic_block.c
+++ b/src/plugins/select/bluegene/plugin/dynamic_block.c
@@ -62,7 +62,7 @@ extern List create_dynamic_block(List block_list,
 	List results = NULL;
 	List new_blocks = NULL;
 	bitstr_t *my_bitmap = NULL;
-	int geo[BA_SYSTEM_DIMENSIONS];
+	int geo[SYSTEM_DIMENSIONS];
 	int i;
 	blockreq_t blockreq;
 	int cnodes = request->procs / bg_conf->cpu_ratio;
@@ -89,7 +89,7 @@ extern List create_dynamic_block(List block_list,
 
 			if(!bit_super_set(bg_record->bitmap, my_bitmap)) {
 				bit_or(my_bitmap, bg_record->bitmap);
-				for(i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+				for(i=0; i<SYSTEM_DIMENSIONS; i++)
 					geo[i] = bg_record->geo[i];
 				debug2("adding %s %c%c%c %c%c%c",
 				       bg_record->nodes,
@@ -369,7 +369,7 @@ extern bg_record_t *create_small_record(bg_record_t *bg_record,
 	} else {
 		int i=0,j=0;
 		new_ba_node = ba_copy_node(ba_node);
-		for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){
+		for (i=0; i<SYSTEM_DIMENSIONS; i++){
 			for(j=0;j<NUM_PORTS_PER_NODE;j++) {
 				ba_node->axis_switch[i].int_wire[j].used = 0;
 				if(i!=X) {
diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c
index 719d602b1225eac8a5dbf6bf67e38d0f04d9f10d..7cc0300afd2aead01a1435b1acc1684924f878dc 100644
--- a/src/plugins/select/bluegene/plugin/select_bluegene.c
+++ b/src/plugins/select/bluegene/plugin/select_bluegene.c
@@ -944,7 +944,7 @@ extern int select_p_update_sub_node (update_block_msg_t *block_desc_ptr)
 #ifdef HAVE_BG
 	int rc = SLURM_SUCCESS;
 	int i = 0, j = 0;
-	char coord[BA_SYSTEM_DIMENSIONS+1], *node_name = NULL;
+	char coord[SYSTEM_DIMENSIONS+1], *node_name = NULL;
 	char ionodes[128];
 	int set = 0;
 	double nc_pos = 0, last_pos = -1;
@@ -1006,7 +1006,7 @@ extern int select_p_update_sub_node (update_block_msg_t *block_desc_ptr)
 				goto end_it;
 			}
 			/* make sure we are asking for a correct name */
-			for(i = 0; i < BA_SYSTEM_DIMENSIONS; i++) {
+			for(i = 0; i < SYSTEM_DIMENSIONS; i++) {
 				if((name[j+i] >= '0'
 				    && name[j+i] <= '9')
 				   || (name[j+i] >= 'A'
@@ -1021,8 +1021,8 @@ extern int select_p_update_sub_node (update_block_msg_t *block_desc_ptr)
 			}
 
 			strncpy(coord, name+j,
-				BA_SYSTEM_DIMENSIONS);
-			j += BA_SYSTEM_DIMENSIONS-1;
+				SYSTEM_DIMENSIONS);
+			j += SYSTEM_DIMENSIONS-1;
 			set++;
 		}
 		j++;
@@ -1150,7 +1150,7 @@ extern int select_p_alter_node_cnt(enum select_node_cnt type, void *data)
 	uint16_t *cpus = (uint16_t *)data;
 	uint32_t *nodes = (uint32_t *)data, tmp;
 	int i;
-	uint16_t req_geometry[BA_SYSTEM_DIMENSIONS];
+	uint16_t req_geometry[SYSTEM_DIMENSIONS];
 
 	if(!bg_conf->bp_node_cnt) {
 		fatal("select_p_alter_node_cnt: This can't be called "
@@ -1214,7 +1214,7 @@ extern int select_p_alter_node_cnt(enum select_node_cnt type, void *data)
 		if(req_geometry[0] != 0
 		   && req_geometry[0] != (uint16_t)NO_VAL) {
 			job_desc->min_nodes = 1;
-			for (i=0; i<BA_SYSTEM_DIMENSIONS; i++)
+			for (i=0; i<SYSTEM_DIMENSIONS; i++)
 				job_desc->min_nodes *=
 					(uint16_t)req_geometry[i];
 			job_desc->min_nodes *= bg_conf->bp_node_cnt;
diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c
index f48d89ac7d45e1d0c2805d6f5a94b7338609564f..49c9b04ae9de5c4b77da6a09cab9815d891ae0ef 100644
--- a/src/sbatch/opt.c
+++ b/src/sbatch/opt.c
@@ -341,7 +341,7 @@ static void _opt_default()
 	opt.nodelist	    = NULL;
 	opt.exc_nodes	    = NULL;
 
-	for (i=0; i<SYSTEM_DIMENSIONS; i++)
+	for (i=0; i<HIGHEST_DIMENSIONS; i++)
 		opt.geometry[i]	    = (uint16_t) NO_VAL;
 	opt.reboot          = false;
 	opt.no_rotate	    = false;
diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c
index 0969d51b7340a9c25438c7937607d326a703389e..409693b7bce8654eafa39714de6f9875026ddf07 100644
--- a/src/smap/configure_functions.c
+++ b/src/smap/configure_functions.c
@@ -407,7 +407,7 @@ static int _create_allocation(char *com, List allocated_blocks)
 					request->geometry[X] =
 						xstrntol(&com[geoi],
 							 NULL, diff,
-							 HOSTLIST_BASE);
+							 params.cluster_base);
 				}
 				geoi += diff;
 				diff = geoi;
@@ -426,7 +426,7 @@ static int _create_allocation(char *com, List allocated_blocks)
 					request->geometry[Y] =
 						xstrntol(&com[geoi],
 							 NULL, diff,
-							 HOSTLIST_BASE);
+							 params.cluster_base);
 				}
 				geoi += diff;
 				diff = geoi;
@@ -445,7 +445,7 @@ static int _create_allocation(char *com, List allocated_blocks)
 					request->geometry[Z] =
 						xstrntol(&com[geoi],
 							 NULL, diff,
-							 HOSTLIST_BASE);
+							 params.cluster_base);
 				}
 				request->size = -1;
 				break;
@@ -465,7 +465,8 @@ static int _create_allocation(char *com, List allocated_blocks)
 			} else {
 				request->start[X] = xstrntol(&com[starti],
 							     NULL, diff,
-							     HOSTLIST_BASE);
+							     params.
+							     cluster_base);
 			}
 			starti += diff;
 			if(starti==len)
@@ -484,7 +485,7 @@ static int _create_allocation(char *com, List allocated_blocks)
 			} else {
 				request->start[Y] = xstrntol(&com[starti],
 							     NULL, diff,
-							     HOSTLIST_BASE);
+							     params.cluster_base);
 			}
 			starti += diff;
 			if(starti==len)
@@ -503,7 +504,8 @@ static int _create_allocation(char *com, List allocated_blocks)
 			} else {
 				request->start[Z] = xstrntol(&com[starti],
 							     NULL, diff,
-							     HOSTLIST_BASE);
+							     params.
+							     cluster_base);
 			}
 		}
 	start_request:
@@ -631,14 +633,14 @@ static int _change_state_all_bps(char *com, int state)
 	char allnodes[50];
 	memset(allnodes,0,50);
 
-#ifdef HAVE_3D
-	sprintf(allnodes, "000x%c%c%c",
-		alpha_num[DIM_SIZE[X]-1], alpha_num[DIM_SIZE[Y]-1],
-		alpha_num[DIM_SIZE[Z]-1]);
-#else
-	sprintf(allnodes, "0-%d",
-		DIM_SIZE[X]);
-#endif
+	if(params.cluster_dims == 3)
+		sprintf(allnodes, "000x%c%c%c",
+			alpha_num[DIM_SIZE[X]-1], alpha_num[DIM_SIZE[Y]-1],
+			alpha_num[DIM_SIZE[Z]-1]);
+	else
+		sprintf(allnodes, "0-%d",
+			DIM_SIZE[X]);
+
 	return _change_state_bps(allnodes, state);
 
 }
@@ -646,14 +648,13 @@ static int _change_state_bps(char *com, int state)
 {
 	int i=0, x;
 	int len = strlen(com);
-	int start[SYSTEM_DIMENSIONS], end[SYSTEM_DIMENSIONS];
-#ifdef HAVE_3D
+	int start[params.cluster_dims], end[params.cluster_dims];
 	int number=0, y=0, z=0, j=0;
-#endif
 	char letter = '.';
 	char opposite = '#';
 	bool used = false;
 	char *c_state = "up";
+	char *p = '\0';
 
 	if(state == NODE_STATE_DOWN) {
 		letter = '#';
@@ -674,7 +675,35 @@ static int _change_state_bps(char *com, int state)
 		return 0;
 	}
 
-#ifdef HAVE_3D
+	if(params.cluster_dims == 1) {
+		if ((com[i+3] == 'x')
+		    || (com[i+3] == '-')) {
+			start[X] =  xstrntol(com + i, NULL,
+					     params.cluster_dims,
+					     params.cluster_base);
+			i += 4;
+			end[X] =  xstrntol(com + i, NULL,
+					   params.cluster_dims,
+					   params.cluster_base);
+		} else {
+			start[X] = end[X] =  xstrntol(com + i, NULL,
+						      params.cluster_dims,
+						      params.cluster_base);
+		}
+
+		if((start[X]>end[X])
+		   || (start[X]<0)
+		   || (end[X]>DIM_SIZE[X]-1))
+			goto error_message;
+
+		for(x=start[X];x<=end[X];x++) {
+			ba_system_ptr->grid[x][0][0].color = 0;
+			ba_system_ptr->grid[x][0][0].letter = letter;
+			ba_system_ptr->grid[x][0][0].used = used;
+		}
+		return 1;
+	}
+
 	if ((com[i+3] == 'x')
 	    || (com[i+3] == '-')) {
 		for(j=0; j<3; j++) {
@@ -685,12 +714,10 @@ static int _change_state_bps(char *com, int state)
 			goto error_message2;
 
 		}
-		number = xstrntol(com + i, NULL,
-				  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-		start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-		start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-			/ HOSTLIST_BASE;
-		start[Z] = (number % HOSTLIST_BASE);
+		number = strtoul(com + i, &p, params.cluster_base);
+		hostlist_parse_int_to_array(
+			number, start, params.cluster_dims,
+			params.cluster_base);
 
 		i += 4;
 		for(j=0; j<3; j++) {
@@ -700,12 +727,10 @@ static int _change_state_bps(char *com, int state)
 				continue;
 			goto error_message2;
 		}
-		number = xstrntol(com + i, NULL,
-				  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-		end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-		end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-			/ HOSTLIST_BASE;
-		end[Z] = (number % HOSTLIST_BASE);
+		number = strtoul(com + i, &p,  params.cluster_base);
+		hostlist_parse_int_to_array(
+			number, end, params.cluster_dims,
+			params.cluster_base);
 	} else {
 		for(j=0; j<3; j++) {
 			if (((i+j) <= len) &&
@@ -714,12 +739,10 @@ static int _change_state_bps(char *com, int state)
 				continue;
 			goto error_message2;
 		}
-		number = xstrntol(com + i, NULL,
-				  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-		start[X] = end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-		start[Y] = end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-			/ HOSTLIST_BASE;
-		start[Z] = end[Z] = (number % HOSTLIST_BASE);
+		number = strtoul(com + i, &p,  params.cluster_base);
+		hostlist_parse_int_to_array(
+			number, start, params.cluster_dims,
+			params.cluster_base);
 	}
 	if((start[X]>end[X]
 	    || start[Y]>end[Y]
@@ -744,47 +767,22 @@ static int _change_state_bps(char *com, int state)
 			}
 		}
 	}
-#else
-	if ((com[i+3] == 'x')
-	    || (com[i+3] == '-')) {
-		start[X] =  xstrntol(com + i, NULL,
-				    BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-		i += 4;
-		end[X] =  xstrntol(com + i, NULL,
-				   BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-	} else {
-		start[X] = end[X] =  xstrntol(com + i, NULL,
-					      BA_SYSTEM_DIMENSIONS,
-					      HOSTLIST_BASE);
-	}
-
-	if((start[X]>end[X])
-	   || (start[X]<0)
-	   || (end[X]>DIM_SIZE[X]-1))
-		goto error_message;
-
-	for(x=start[X];x<=end[X];x++) {
-		ba_system_ptr->grid[x].color = 0;
-		ba_system_ptr->grid[x].letter = letter;
-		ba_system_ptr->grid[x].used = used;
-	}
-#endif
 	return 1;
 error_message:
 	memset(error_string,0,255);
-#ifdef HAVE_BG
-	sprintf(error_string,
-		"Problem with base partitions, "
-		"specified range was %d%d%dx%d%d%d",
-		alpha_num[start[X]],alpha_num[start[Y]],alpha_num[start[Z]],
-		alpha_num[end[X]],alpha_num[end[Y]],alpha_num[end[Z]]);
-#else
-	sprintf(error_string,
-		"Problem with nodes,  specified range was %d-%d",
-		start[X],end[X]);
-#endif
+	if(params.cluster_dims == 1) {
+		sprintf(error_string,
+			"Problem with nodes,  specified range was %d-%d",
+			start[X],end[X]);
+	} else {
+		sprintf(error_string,
+			"Problem with base partitions, "
+			"specified range was %d%d%dx%d%d%d",
+			alpha_num[start[X]],alpha_num[start[Y]],
+			alpha_num[start[Z]],
+			alpha_num[end[X]],alpha_num[end[Y]],alpha_num[end[Z]]);
+	}
 	return 0;
-#ifdef HAVE_3D
 error_message2:
 	memset(error_string,0,255);
 	sprintf(error_string,
@@ -792,7 +790,6 @@ error_message2:
 		"You need to specify XYZ or XYZxXYZ",
 		com+i,com);
 	return 0;
-#endif
 }
 static int _remove_allocation(char *com, List allocated_blocks)
 {
@@ -905,7 +902,7 @@ static int _copy_allocation(char *com, List allocated_blocks)
 
 	if(i<=len) {
 		/* Here we are looking for a real number for the count
-		   instead of the HOSTLIST_BASE so atoi is ok
+		   instead of the params.cluster_base so atoi is ok
 		*/
 		if(com[i]>='0' && com[i]<='9')
 			count = atoi(com+i);
@@ -1126,15 +1123,16 @@ static int _add_bg_record(blockreq_t *blockreq, List allocated_blocks)
 	int bp_count = 0;
 	int diff=0;
 	int largest_diff=-1;
-	int start[BA_SYSTEM_DIMENSIONS];
-	int end[BA_SYSTEM_DIMENSIONS];
-	int start1[BA_SYSTEM_DIMENSIONS];
-	int end1[BA_SYSTEM_DIMENSIONS];
-	int geo[BA_SYSTEM_DIMENSIONS];
+	int start[params.cluster_dims];
+	int end[params.cluster_dims];
+	int start1[params.cluster_dims];
+	int end1[params.cluster_dims];
+	int geo[params.cluster_dims];
 	char com[255];
 	int j = 0, number;
 	int len = 0;
 	int x,y,z;
+	char *p = '\0';
 
 	geo[X] = 0;
 	geo[Y] = 0;
@@ -1172,21 +1170,15 @@ static int _add_bg_record(blockreq_t *blockreq, List allocated_blocks)
 		    && (nodes[j+8] == ']' || nodes[j+8] == ',')
 		    && (nodes[j+4] == 'x' || nodes[j+4] == '-')) {
 			j++;
-			number = xstrntol(nodes + j, NULL,
-					  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-			start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			start[Z] = (number % HOSTLIST_BASE);
-
+			number = strtoul(nodes + j, &p, params.cluster_base);
+			hostlist_parse_int_to_array(
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j += 4;
-			number = xstrntol(nodes + j, NULL,
-					  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-			end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			end[Z] = (number % HOSTLIST_BASE);
-
+			number = strtoul(nodes + j, &p, params.cluster_base);
+			hostlist_parse_int_to_array(
+				number, end, params.cluster_dims,
+				params.cluster_base);
 			j += 3;
 			diff = end[X]-start[X];
 			if(diff > largest_diff) {
@@ -1216,13 +1208,10 @@ static int _add_bg_record(blockreq_t *blockreq, List allocated_blocks)
 			j--;
 		} else if((nodes[j] >= '0' && nodes[j] <= '9')
 			  || (nodes[j] >= 'A' && nodes[j] <= 'Z')) {
-			number = xstrntol(nodes + j, NULL,
-					  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
-			start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
-			start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
-				/ HOSTLIST_BASE;
-			start[Z] = (number % HOSTLIST_BASE);
-
+			number = strtoul(nodes + j, &p, params.cluster_base);
+			hostlist_parse_int_to_array(
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j+=3;
 			diff = 0;
 			if(diff > largest_diff) {
diff --git a/src/smap/grid_functions.c b/src/smap/grid_functions.c
index d67a4876809eb76773eb5612f1406aa571b5eeb2..1e353a582f7b6b95ec2712f42d76cbe8a278e3ac 100644
--- a/src/smap/grid_functions.c
+++ b/src/smap/grid_functions.c
@@ -40,7 +40,6 @@
 
 #include "src/smap/smap.h"
 
-#ifdef HAVE_3D
 static int _coord(char coord)
 {
 	if ((coord >= '0') && (coord <= '9'))
@@ -50,55 +49,58 @@ static int _coord(char coord)
 	return -1;
 }
 
-#endif
-
 /* Set grid color based upon node names containing X-, Y- and Z-
  * coordinates in last three positions. It is not based upon the
  * nodes in the node table being numerically ordered. */
 extern int set_grid_name(char *nodes, int count)
 {
-#ifdef HAVE_3D
 	hostlist_t hl;
 	char *node;
 	int i, x = 0, y = 0, z = 0;
+	int *use_dims = working_cluster_rec ?
+		working_cluster_rec->dim_size : DIM_SIZE;
 
 	if (!nodes)
 		return 1;
 
-	hl = hostlist_create(nodes);
-	while ((node = hostlist_shift(hl))) {
-		i = strlen(node);
-		if (i < 4)
-			x = -1;
-		else {
-			x = _coord(node[i-3]);
-			y = _coord(node[i-2]);
-			z = _coord(node[i-1]);
-		}
-		if ((ba_system_ptr->grid[x][y][z].state
-				!= NODE_STATE_DOWN) &&
-		    (!(ba_system_ptr->grid[x][y][z].state
-				& NODE_STATE_DRAIN)) &&
-		    (x >= 0) && (x < DIM_SIZE[X]) &&
-		    (y >= 0) && (y < DIM_SIZE[Y]) &&
-		    (z >= 0) && (z < DIM_SIZE[Z])) {
-			ba_system_ptr->grid[x][y][z].letter =
-				letters[count%62];
-			ba_system_ptr->grid[x][y][z].color =
-				colors[count%6];
+	if(params.cluster_dims == 4) {
+		/* FIX ME: smap doesn't do anything correctly with
+		   more than 3 dims yet.
+		*/
+	} else if(params.cluster_dims == 3) {
+		hl = hostlist_create(nodes);
+		while ((node = hostlist_shift(hl))) {
+			i = strlen(node);
+			if (i < 4)
+				x = -1;
+			else {
+				x = _coord(node[i-3]);
+				y = _coord(node[i-2]);
+				z = _coord(node[i-1]);
+			}
+			if ((ba_system_ptr->grid[x][y][z].state
+			     != NODE_STATE_DOWN) &&
+			    (!(ba_system_ptr->grid[x][y][z].state
+			       & NODE_STATE_DRAIN)) &&
+			    (x >= 0) && (x < use_dims[X]) &&
+			    (y >= 0) && (y < use_dims[Y]) &&
+			    (z >= 0) && (z < use_dims[Z])) {
+				ba_system_ptr->grid[x][y][z].letter =
+					letters[count%62];
+				ba_system_ptr->grid[x][y][z].color =
+					colors[count%6];
+			}
+			free(node);
 		}
-		free(node);
+		hostlist_destroy(hl);
 	}
-	hostlist_destroy(hl);
-#endif
+
 	return 1;
 }
 
 extern int set_grid_inx(int start, int end, int count)
 {
-	int x;
-#ifdef HAVE_3D
-	int y, z;
+	int x, y, z;
 	for (y = DIM_SIZE[Y] - 1; y >= 0; y--) {
 		for (z = 0; z < DIM_SIZE[Z]; z++) {
 			for (x = 0; x < DIM_SIZE[X]; x++) {
@@ -120,36 +122,20 @@ extern int set_grid_inx(int start, int end, int count)
 			}
 		}
 	}
-#else
-	for (x = 0; x < DIM_SIZE[X]; x++) {
-		if ((ba_system_ptr->grid[x].index < start)
-		    ||  (ba_system_ptr->grid[x].index > end))
-			continue;
-		if ((ba_system_ptr->grid[x].state == NODE_STATE_DOWN)
-		    ||  (ba_system_ptr->grid[x].state & NODE_STATE_DRAIN))
-			continue;
-
-		ba_system_ptr->grid[x].letter = letters[count%62];
-		ba_system_ptr->grid[x].color = colors[count%6];
-	}
-#endif
 	return 1;
 }
 
 /* This function is only called when HAVE_BG is set */
 extern int set_grid_bg(int *start, int *end, int count, int set)
 {
-	int x=0;
+	int x=0, y=0, z=0;
 	int i = 0;
-#ifdef HAVE_3D
-	int y=0, z=0;
-#endif
+
 	assert(end[X] < DIM_SIZE[X]);
 	assert(start[X] >= 0);
 	assert(count >= 0);
 	assert(set >= 0);
 	assert(set <= 2);
-#ifdef HAVE_3D
 	assert(end[Y] < DIM_SIZE[Y]);
 	assert(start[Y] >= 0);
 	assert(end[Z] < DIM_SIZE[Z]);
@@ -179,18 +165,6 @@ extern int set_grid_bg(int *start, int *end, int count, int set)
 			}
 		}
 	}
-#else
-	for (x = start[X]; x <= end[X]; x++) {
-		if(!set) {
-			ba_system_ptr->grid[x].letter =
-				letters[count%62];
-			ba_system_ptr->grid[x].color =
-				colors[count%6];
-		}
-		i++;
-	}
-
-#endif
 
 	return i;
 }
@@ -200,9 +174,8 @@ extern void print_grid(int dir)
 {
 	int x;
 	int grid_xcord, grid_ycord = 2;
-
-#ifdef HAVE_3D
 	int y, z, offset = DIM_SIZE[Z];
+
 	for (y = DIM_SIZE[Y] - 1; y >= 0; y--) {
 		offset = DIM_SIZE[Z] + 1;
 		for (z = 0; z < DIM_SIZE[Z]; z++) {
@@ -239,39 +212,6 @@ extern void print_grid(int dir)
 		}
 		grid_ycord++;
 	}
-#else
-	grid_xcord=1;
-	grid_ycord=1;
-
-	for (x = dir; x < DIM_SIZE[X]; x++) {
-		if (ba_system_ptr->grid[x].color)
-			init_pair(ba_system_ptr->grid[x].color,
-				  ba_system_ptr->grid[x].color,
-				  COLOR_BLACK);
-		else
-			init_pair(ba_system_ptr->grid[x].color,
-				  ba_system_ptr->grid[x].color,
-				  7);
-
-		wattron(grid_win,
-			COLOR_PAIR(ba_system_ptr->grid[x].color));
-
-		mvwprintw(grid_win,
-			  grid_ycord, grid_xcord, "%c",
-			  ba_system_ptr->grid[x].letter);
-		wattroff(grid_win,
-			 COLOR_PAIR(ba_system_ptr->grid[x].color));
-
-		grid_xcord++;
-		if(grid_xcord==grid_win->_maxx) {
-			grid_xcord=1;
-			grid_ycord++;
-		}
-		if(grid_ycord==grid_win->_maxy) {
-			break;
-		}
-	}
-#endif
 	return;
 }
 
diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c
index 536d7b496f24f51ef9503a5e4b6d7ec60306c2f4..85af0b0eca380d144d482eedce80bcc49f56f2ea 100644
--- a/src/smap/job_functions.c
+++ b/src/smap/job_functions.c
@@ -215,16 +215,16 @@ static void _print_header_job(void)
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "PARTITION");
 		main_xcord += 10;
-#ifdef HAVE_BG
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "BG_BLOCK");
-		main_xcord += 18;
-#endif
-#ifdef HAVE_CRAY_XT
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "RESV_ID");
-		main_xcord += 18;
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG) {
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "BG_BLOCK");
+			main_xcord += 18;
+		}
+		if(params.cluster_flags & CLUSTER_FLAG_CRAYXT) {
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "RESV_ID");
+			main_xcord += 18;
+		}
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "USER");
 		main_xcord += 9;
@@ -240,31 +240,28 @@ static void _print_header_job(void)
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "NODES");
 		main_xcord += 6;
-#ifdef HAVE_BG
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "BP_LIST");
-#else
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "NODELIST");
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG)
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "BP_LIST");
+		else
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "NODELIST");
 		main_xcord = 1;
 		main_ycord++;
 	} else {
 		printf("   JOBID ");
 		printf("PARTITION ");
-#ifdef HAVE_BG
-		printf("        BG_BLOCK ");
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG)
+			printf("        BG_BLOCK ");
 		printf("    USER ");
 		printf("  NAME ");
 		printf("ST ");
 		printf("      TIME ");
 		printf("NODES ");
-#ifdef HAVE_BG
-		printf("BP_LIST\n");
-#else
-		printf("NODELIST\n");
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG)
+			printf("BP_LIST\n");
+		else
+			printf("NODELIST\n");
 	}
 }
 
@@ -282,25 +279,27 @@ static int _print_text_job(job_info_t * job_ptr)
 	char *ionodes = NULL, *uname;
 	time_t now_time = time(NULL);
 
-#ifdef HAVE_BG
-	select_g_select_jobinfo_get(job_ptr->select_jobinfo,
-				    SELECT_JOBDATA_IONODES,
-				    &ionodes);
-	select_g_select_jobinfo_get(job_ptr->select_jobinfo,
-				    SELECT_JOBDATA_NODE_CNT,
-				    &node_cnt);
-	if(!strcasecmp(job_ptr->nodes,"waiting..."))
-		xfree(ionodes);
-#else
-	node_cnt = job_ptr->num_nodes;
-#endif
+	if(params.cluster_flags & CLUSTER_FLAG_BG) {
+		select_g_select_jobinfo_get(job_ptr->select_jobinfo,
+					    SELECT_JOBDATA_IONODES,
+					    &ionodes);
+		select_g_select_jobinfo_get(job_ptr->select_jobinfo,
+					    SELECT_JOBDATA_NODE_CNT,
+					    &node_cnt);
+		if(!strcasecmp(job_ptr->nodes,"waiting..."))
+			xfree(ionodes);
+	} else
+		node_cnt = job_ptr->num_nodes;
+
 	if ((node_cnt  == 0) || (node_cnt == NO_VAL))
 		node_cnt = _get_node_cnt(job_ptr);
-#ifdef HAVE_BG
-	convert_num_unit((float)node_cnt, tmp_cnt, sizeof(tmp_cnt), UNIT_NONE);
-#else
-	snprintf(tmp_cnt, sizeof(tmp_cnt), "%d", node_cnt);
-#endif
+
+	if(params.cluster_flags & CLUSTER_FLAG_BG)
+		convert_num_unit((float)node_cnt, tmp_cnt,
+				 sizeof(tmp_cnt), UNIT_NONE);
+	else
+		snprintf(tmp_cnt, sizeof(tmp_cnt), "%d", node_cnt);
+
 	if(!params.commandline) {
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "%c", job_ptr->num_cpus);
@@ -311,25 +310,25 @@ static int _print_text_job(job_info_t * job_ptr)
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "%.10s", job_ptr->partition);
 		main_xcord += 10;
-#ifdef HAVE_BG
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "%.16s",
-			  select_g_select_jobinfo_sprint(
-				  job_ptr->select_jobinfo,
-				  time_buf,
-				  sizeof(time_buf),
-				  SELECT_PRINT_BG_ID));
-		main_xcord += 18;
-#endif
-#ifdef HAVE_CRAY_XT
-		mvwprintw(text_win, main_ycord,
-			  main_xcord, "%.16s",
-			  select_g_select_jobinfo_sprint(job_ptr->select_jobinfo,
-							 time_buf,
-							 sizeof(time_buf),
-							 SELECT_PRINT_RESV_ID));
-		main_xcord += 18;
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG) {
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "%.16s",
+				  select_g_select_jobinfo_sprint(
+					  job_ptr->select_jobinfo,
+					  time_buf,
+					  sizeof(time_buf),
+					  SELECT_PRINT_BG_ID));
+			main_xcord += 18;
+		}
+		if(params.cluster_flags & CLUSTER_FLAG_CRAYXT) {
+			mvwprintw(text_win, main_ycord,
+				  main_xcord, "%.16s",
+				  select_g_select_jobinfo_sprint(
+					  job_ptr->select_jobinfo,
+					  time_buf, sizeof(time_buf),
+					  SELECT_PRINT_RESV_ID));
+			main_xcord += 18;
+		}
 		uname = uid_to_string((uid_t) job_ptr->user_id);
 		mvwprintw(text_win, main_ycord,
 			  main_xcord, "%.8s", uname);
@@ -397,20 +396,18 @@ static int _print_text_job(job_info_t * job_ptr)
 	} else {
 		printf("%8d ", job_ptr->job_id);
 		printf("%9.9s ", job_ptr->partition);
-#ifdef HAVE_BG
-		printf("%16.16s ",
-		       select_g_select_jobinfo_sprint(job_ptr->select_jobinfo,
-						      time_buf,
-						      sizeof(time_buf),
-						      SELECT_PRINT_BG_ID));
-#endif
-#ifdef HAVE_CRAY_XT
-		printf("%16.16s ",
-		       select_g_select_jobinfo_sprint(job_ptr->select_jobinfo,
-						      time_buf,
-						      sizeof(time_buf),
-						      SELECT_PRINT_RESV_ID));
-#endif
+		if(params.cluster_flags & CLUSTER_FLAG_BG)
+			printf("%16.16s ",
+			       select_g_select_jobinfo_sprint(
+				       job_ptr->select_jobinfo,
+				       time_buf, sizeof(time_buf),
+				       SELECT_PRINT_BG_ID));
+		if(params.cluster_flags & CLUSTER_FLAG_CRAYXT)
+			printf("%16.16s ",
+			       select_g_select_jobinfo_sprint(
+				       job_ptr->select_jobinfo,
+				       time_buf, sizeof(time_buf),
+				       SELECT_PRINT_RESV_ID));
 		uname = uid_to_string((uid_t) job_ptr->user_id);
 		printf("%8.8s ", uname);
 		xfree(uname);
diff --git a/src/smap/opts.c b/src/smap/opts.c
index 951c4b6bb81a134c691f61c5ddc407c79ec1539d..b4e0645df74612c12ed7e119393414bbc96741e2 100644
--- a/src/smap/opts.c
+++ b/src/smap/opts.c
@@ -169,6 +169,7 @@ extern void parse_command_line(int argc, char *argv[])
 			exit(0);
 		}
 	}
+	params.cluster_base = hostlist_get_base();
 	params.cluster_dims = slurmdb_setup_cluster_dims();
 	params.cluster_flags = slurmdb_setup_cluster_flags();
 }
diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c
index 376cd53325e28715c9ff34d671a7b05fcb0de6d0..544f2ddbd214c75ed5d3dd901d8df077de4e68a6 100644
--- a/src/smap/partition_functions.c
+++ b/src/smap/partition_functions.c
@@ -388,7 +388,7 @@ extern void get_bg_part()
 
 	if (params.commandline && params.iterate)
 		printf("\n");
-	
+
 	part_info_ptr = new_part_ptr;
 	bg_info_ptr = new_bg_ptr;
 	return;
@@ -397,11 +397,9 @@ extern void get_bg_part()
 static int _marknodes(db2_block_info_t *block_ptr, int count)
 {
 	int j=0;
-	int start[BA_SYSTEM_DIMENSIONS];
-	int end[BA_SYSTEM_DIMENSIONS];
+	int start[params.cluster_dims];
+	int end[params.cluster_dims];
 	int number = 0;
-	int dims = slurmdb_setup_cluster_dims();
-	int hostlist_base = hostlist_get_base();
 	char *p = '\0';
 
 	block_ptr->letter_num = count;
@@ -414,14 +412,16 @@ static int _marknodes(db2_block_info_t *block_ptr, int count)
 			|| block_ptr->nodes[j+4] == '-')) {
 			j++;
 			number = strtoul(block_ptr->nodes + j, &p,
-					 hostlist_base);
+					 params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, start, dims, hostlist_base);
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j += 4;
 			number = strtoul(block_ptr->nodes + j, &p,
-					 hostlist_base);
+					 params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, end, dims, hostlist_base);
+				number, end, params.cluster_dims,
+				params.cluster_base);
 			j += 3;
 
 			if(block_ptr->state != RM_PARTITION_FREE)
@@ -439,9 +439,10 @@ static int _marknodes(db2_block_info_t *block_ptr, int count)
 			      && block_ptr->nodes[j] <= 'Z')) {
 
 			number = strtoul(block_ptr->nodes + j, &p,
-					 hostlist_base);
+					 params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, start, dims, hostlist_base);
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j+=3;
 			block_ptr->size += set_grid_bg(
 				start, start, count, 0);
@@ -908,11 +909,9 @@ static int _addto_nodelist(List nodelist, int *start, int *end)
 {
 	int *coord = NULL;
 	int x,y,z;
-	int *use_dims = working_cluster_rec ?
-		working_cluster_rec->dim_size : DIM_SIZE;
-	if(end[X] >= use_dims[X]
-	   || end[Y] >= use_dims[Y]
-	   || end[Z] >= use_dims[Z]) {
+	if(end[X] >= DIM_SIZE[X]
+	   || end[Y] >= DIM_SIZE[Y]
+	   || end[Z] >= DIM_SIZE[Z]) {
 		fatal("It appears the slurm.conf file has changed since "
 		      "the last restart.\nThings are in an incompatible "
 		      "state, please restart the slurmctld.");
@@ -940,11 +939,9 @@ static int _make_nodelist(char *nodes, List nodelist)
 {
 	int j = 0;
 	int number;
-	int start[BA_SYSTEM_DIMENSIONS];
-	int end[BA_SYSTEM_DIMENSIONS];
+	int start[params.cluster_dims];
+	int end[params.cluster_dims];
 	char *p = '\0';
-	int dims = slurmdb_setup_cluster_dims();
-	int hostlist_base = hostlist_get_base();
 
 	if(!nodelist)
 		nodelist = list_create(_nodelist_del);
@@ -956,13 +953,15 @@ static int _make_nodelist(char *nodes, List nodelist)
 		    && (nodes[j+4] == 'x'
 			|| nodes[j+4] == '-')) {
 			j++;
-			number = strtoul(nodes + j, &p, hostlist_base);
+			number = strtoul(nodes + j, &p, params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, start, dims, hostlist_base);
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j += 4;
-			number = strtoul(nodes + j, &p, hostlist_base);
+			number = strtoul(nodes + j, &p, params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, end, dims, hostlist_base);
+				number, end, params.cluster_dims,
+				params.cluster_base);
 			j += 3;
 			_addto_nodelist(nodelist, start, end);
 			if(nodes[j] != ',')
@@ -971,9 +970,10 @@ static int _make_nodelist(char *nodes, List nodelist)
 		} else if((nodes[j] >= '0' && nodes[j] <= '9')
 			  || (nodes[j] >= 'A' && nodes[j] <= 'Z')) {
 
-			number = strtoul(nodes + j, &p, hostlist_base);
+			number = strtoul(nodes + j, &p, params.cluster_base);
 			hostlist_parse_int_to_array(
-				number, start, dims, hostlist_base);
+				number, start, params.cluster_dims,
+				params.cluster_base);
 			j+=3;
 			_addto_nodelist(nodelist, start, start);
 			if(nodes[j] != ',')
diff --git a/src/smap/smap.h b/src/smap/smap.h
index 5ea1eb4cdbf2e40e8535f2daf58b732fa6f13861..e4a93f2ca81c0480a03f170fd57540529625cf7d 100644
--- a/src/smap/smap.h
+++ b/src/smap/smap.h
@@ -115,6 +115,7 @@ enum { JOBS, RESERVATIONS, SLURMPART, BGPART, COMMANDS };
 typedef struct {
 	bool all_flag;
 	List clusters;
+	int cluster_base;
 	uint16_t cluster_dims;
 	uint32_t cluster_flags;
 	bool commandline;