diff --git a/src/partition_allocator/partition_allocator.c b/src/partition_allocator/partition_allocator.c
index 1d637066573a1fdc06cded6167ca6eff605fb941..f1ab0e8ffd306194b85ac7f4fcacc2bf072392bc 100644
--- a/src/partition_allocator/partition_allocator.c
+++ b/src/partition_allocator/partition_allocator.c
@@ -1387,10 +1387,10 @@ static int _configure_dims(int *coord, int *start, int *end)
 			/*****************************/
 			
 		} else if(coord[dim]==(end[dim]-1)) {
-			if(dim == Y) {
-				printf("hey I am looking at %d%d%d as a target from %d%d%d\n",target[X],target[Y],target[Z],coord[X],coord[Y],coord[Z]);
+			/* if(dim == Y) { */
+/* 				printf("hey I am looking at %d%d%d as a target from %d%d%d\n",target[X],target[Y],target[Z],coord[X],coord[Y],coord[Z]); */
 				
-			}
+/* 			} */
 			
 			if(!curr_switch->int_wire[0].used) {
 				_find_best_path(curr_switch, 0, target, target, dim, 0);
diff --git a/src/plugins/select/bluegene/bgl_switch_connections.c b/src/plugins/select/bluegene/bgl_switch_connections.c
index 938a79e6995a780d3ad8be02a1128b2d00fe393c..353f0eb48a4ecf80823ca67da7d409fa0fcb703c 100644
--- a/src/plugins/select/bluegene/bgl_switch_connections.c
+++ b/src/plugins/select/bluegene/bgl_switch_connections.c
@@ -211,7 +211,7 @@ static int _lookat_path(bgl_bp_t *bgl_bp, pa_switch_t *curr_switch, int source,
 	list_iterator_destroy(conn_itr);
 	
 	if(bgl_conn == NULL) {
-		bgl_conn = xmalloc(sizeof(bgl_conn));
+		bgl_conn = xmalloc(sizeof(bgl_conn_t));
 		bgl_conn->source = source;
 		bgl_conn->target = port_tar;
 		//printf("adding to dim %d conn %d -> %d\n\n", dim, source, port_tar);
@@ -265,13 +265,16 @@ static int _destroy_bgl_bp_list(List bgl_bp_list)
 		while((bgl_bp = list_pop(bgl_bp_list)) != NULL) {
 			while((bgl_switch = list_pop(bgl_bp->switch_list)) != NULL) {
 				while((bgl_conn = list_pop(bgl_switch->conn_list)) != NULL) {
-					xfree(bgl_conn);
+					if(bgl_conn)
+						xfree(bgl_conn);
 				}
 				list_destroy(bgl_switch->conn_list);
-				xfree(bgl_switch);
+				if(bgl_switch)
+					xfree(bgl_switch);
 			}
 			list_destroy(bgl_bp->switch_list);
-			xfree(bgl_bp);
+			if(bgl_bp)
+				xfree(bgl_bp);
 		}
 		list_destroy(bgl_bp_list);
 	}
diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c
index e73fab85c3e339c6387ba9c2d39ce29fb4d12512..65928c1876ead21e77ba2ed7b727d135b28bafbf 100644
--- a/src/plugins/select/bluegene/bluegene.c
+++ b/src/plugins/select/bluegene/bluegene.c
@@ -38,6 +38,7 @@ char* bgl_conf = BLUEGENE_CONFIG_FILE;
 rm_BGL_t *bgl;
 List bgl_list = NULL;			/* list of bgl_record entries */
 List bgl_curr_part_list = NULL;  	/* current bgl partitions */
+List bgl_found_part_list = NULL;  	/* found bgl partitions */
 char *bluegene_blrts = NULL, *bluegene_linux = NULL, *bluegene_mloader = NULL;
 char *bluegene_ramdisk = NULL;
 bool agent_fini = false;
@@ -70,12 +71,12 @@ int create_static_partitions(List part_list)
 
 #ifdef HAVE_BGL_FILES
 
-	ListIterator itr, itr_curr;
+	ListIterator itr, itr_curr, itr_found;
 	int number, j=0;
 	int x, y, z;
 	int start[PA_SYSTEM_DIMENSIONS];
 	int end[PA_SYSTEM_DIMENSIONS];
-	bgl_record_t *bgl_record;
+	bgl_record_t *bgl_record, *found_record, *init_record;
 	rm_partition_state_t state;
         
 	pm_partition_id_t part_id[20];
@@ -107,7 +108,7 @@ int create_static_partitions(List part_list)
 /* 	printf("done copying\n"); */
 /* 	_process_config(); */
 
- 	if ((rc = _validate_config_nodes())) { 
+ 	if (!_validate_config_nodes()) { 
 
 	/******************************************************************/
 
@@ -134,56 +135,67 @@ int create_static_partitions(List part_list)
 		part_id[17]="RMP118";
 		part_id[18]="RMP119";
 		part_id[19]="RMP120";
-		bp_num=1;
+		bp_num=5;
 
-		for (i=0; i<bp_num; i++){
+//		for (i=0; i<bp_num; i++){
 
 /* FIXME The next 3 lines are the legitly clear all the allocated partitions out
    done above because IBM is doing wacky things with their partitions so we are unable to 
    clear theirs.  We know these are the basic names that are created. Don't forget to change
    the part_id to a single variable instead of the array when done.*/
 
-//        itr_curr = list_iterator_create(bgl_curr_part_list);
-//        while ((init_record = (bgl_record_t*) list_next(itr_curr))) {
-//                part_id=init_record->bgl_part_id;
-			if ((rc = rm_get_partition(part_id[i], &my_part))
-			    != STATUS_OK) {
-			} else {
+		itr_curr = list_iterator_create(bgl_curr_part_list);
+		while ((init_record = (bgl_record_t*) list_next(itr_curr))) {
+			part_id[i]=init_record->bgl_part_id;
 			
-				rm_get_data(my_part, RM_PartitionUserName, &name);
-				//printf("user name for %s is %s\n",part_id[i],name);
-				//if(!strcmp(name,"")) {
-				printf("destroying %s\n",(char *)part_id[i]);
-				rm_get_data(my_part, RM_PartitionState, &state);
-				if(state != RM_PARTITION_FREE)
-					pm_destroy_partition(part_id[i]);
+			itr_found = list_iterator_create(bgl_found_part_list);
+			while ((found_record = (bgl_record_t*) list_next(itr_found)) != NULL) {
+				if (!strcmp(init_record->bgl_part_id, found_record->bgl_part_id)) {
+					break;	/* don't reboot this one */
+				}
+			}
+			list_iterator_destroy(itr_found);
+			if(found_record == NULL) {
+				if ((rc = rm_get_partition(part_id[i], &my_part))
+				    != STATUS_OK) {
+				} else {
+					
+					rm_get_data(my_part, RM_PartitionUserName, &name);
+					//printf("user name for %s is %s\n",part_id[i],name);
+					//if(!strcmp(name,"")) {
+					printf("destroying %s\n",(char *)part_id[i]);
+					rm_get_data(my_part, RM_PartitionState, &state);
+					if(state != RM_PARTITION_FREE)
+						pm_destroy_partition(part_id[i]);
 			
-				rm_get_data(my_part, RM_PartitionState, &state);
-				while ((state != RM_PARTITION_FREE) 
-				       && (state != RM_PARTITION_ERROR)){
-					printf(".");
-					rc=rm_free_partition(my_part);
-					if(rc!=STATUS_OK){
-						printf("Error freeing partition\n");
-						return(-1);
+					rm_get_data(my_part, RM_PartitionState, &state);
+					while ((state != RM_PARTITION_FREE) 
+					       && (state != RM_PARTITION_ERROR)){
+						printf(".");
+						rc=rm_free_partition(my_part);
+						if(rc!=STATUS_OK){
+							printf("Error freeing partition\n");
+							return(-1);
+						}
+						sleep(3);
+						rc=rm_get_partition(part_id[i],&my_part);
+						if(rc!=STATUS_OK) {
+							printf("Error in GetPartition\n");
+							return(-1);
+						}
+						rm_get_data(my_part, RM_PartitionState, &state);
+						//Free memory allocated to mypart
 					}
+					rm_remove_partition(part_id[i]);
 					sleep(3);
-					rc=rm_get_partition(part_id[i],&my_part);
-					if(rc!=STATUS_OK) {
-						printf("Error in GetPartition\n");
-						return(-1);
-					}
-					rm_get_data(my_part, RM_PartitionState, &state);
-					//Free memory allocated to mypart
-				}
-				rm_remove_partition(part_id[i]);
-				sleep(3);
-				printf("done\n");
-				//}
-				//rm_get_data(bgl, RM_NextBP, &bp);
-			}	
+					printf("done\n");
+					//}
+					//rm_get_data(bgl, RM_NextBP, &bp);
+				}	
+			}
 		}
-	
+		list_iterator_destroy(itr_curr);
+		
 		itr = list_iterator_create(bgl_list);
 		while ((bgl_record = (bgl_record_t *) list_next(itr)) != NULL) {
 			j=0;
@@ -237,9 +249,17 @@ int create_static_partitions(List part_list)
 		list_iterator_destroy(itr);
 	
 		itr = list_iterator_create(bgl_list);
-		while ((bgl_record = (bgl_record_t *) list_next(itr)) != NULL)			
-			configure_partition(bgl_record);
-	
+		while ((bgl_record = (bgl_record_t *) list_next(itr)) != NULL) {
+			itr_found = list_iterator_create(bgl_found_part_list);
+			while ((found_record = (bgl_record_t*) list_next(itr_found)) != NULL) {
+				if (!strcmp(bgl_record->nodes, found_record->nodes)) {
+					break;	/* don't reboot this one */
+				}
+			}
+			list_iterator_destroy(itr_found);
+			if(found_record == NULL)
+				configure_partition(bgl_record);
+		}
 		list_iterator_destroy(itr);
 		rc = SLURM_SUCCESS;
  	} 
@@ -287,16 +307,17 @@ int create_static_partitions(List part_list)
 
 static int  _validate_config_nodes(void)
 {
-	int rc = SLURM_SUCCESS;
 #ifdef HAVE_BGL_FILES
 	bgl_record_t* record;	/* records from configuration files */
 	bgl_record_t* init_record;	/* records from actual BGL config */
 	ListIterator itr_conf, itr_curr;
-	char nodes[1024];
+	int rc = 1;
 
+	bgl_found_part_list = list_create(NULL);
+			
 	/* read current bgl partition info into bgl_curr_part_list */
-	if ((rc = read_bgl_partitions()))
-		return rc;
+	if (read_bgl_partitions() == SLURM_ERROR)
+		return -1;
 
 	itr_conf = list_iterator_create(bgl_list);
 	while ((record = (bgl_record_t*) list_next(itr_conf))) {
@@ -304,28 +325,31 @@ static int  _validate_config_nodes(void)
         	/* search here */
 		itr_curr = list_iterator_create(bgl_curr_part_list);
 		while ((init_record = (bgl_record_t*) list_next(itr_curr))) {
-//info("%s:%s",nodes, init_record->nodes);
-//info("%d:%d", record->conn_type, init_record->conn_type);
-//info("%d:%d", record->node_use, init_record->node_use);
-			if (strcmp(nodes, init_record->nodes))
+/* 			info("%s:%s",record->nodes, init_record->nodes); */
+/* 			info("%d:%d", record->conn_type, init_record->conn_type); */
+/* 			info("%d:%d", record->node_use, init_record->node_use); */
+			if (strcmp(record->nodes, init_record->nodes)) {
 				continue;	/* wrong nodes */
+			}
+			//info("found %s:%s",record->nodes, init_record->nodes);
 			if ((record->conn_type != init_record->conn_type)
-			||  (record->node_use  != init_record->node_use))
+			    ||  (record->node_use  != init_record->node_use))
 				break;		/* must reconfig this part */
-			record->bgl_part_id = xstrdup(init_record->
-					bgl_part_id);
+			record->bgl_part_id = xstrdup(init_record->bgl_part_id);
 			break;
 		}
+		list_iterator_destroy(itr_curr);
 		if (!record->bgl_part_id) {
-			info("BGL PartitionID:NONE Nodes:%s", nodes);
-			return rc;
+			info("BGL PartitionID:NONE Nodes:%s", record->nodes);
+			rc = 0;
 		} else {
+			list_append(bgl_found_part_list, record);
 			info("BGL PartitionID:%s Nodes:%s Conn:%s Mode:%s",
-				record->bgl_part_id, nodes,
+				record->bgl_part_id, record->nodes,
 				convert_conn_type(record->conn_type),
 				convert_node_use(record->node_use));
 		}
-		list_iterator_destroy(itr_curr);
+		
 	}
 	list_iterator_destroy(itr_conf);
 #endif
@@ -836,7 +860,7 @@ extern void print_bgl_record(bgl_record_t* record)
 		return;
 	}
 
-#if _DEBUG
+#if DEBUG
 	info(" bgl_record: ");
 	if (record->bgl_part_id)
 		info("\tbgl_part_id: %s", record->bgl_part_id);
diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c
index 3012f3c1ed5b46b698358603869634bc654278cc..a0255ad8d53607562c492d9919dcacc140faefd9 100755
--- a/src/plugins/select/bluegene/partition_sys.c
+++ b/src/plugins/select/bluegene/partition_sys.c
@@ -192,12 +192,12 @@ static int _post_allocate(bgl_record_t *bgl_record)
 	rm_free_partition(bgl_record->bgl_part);
 	//exit(0);
 	/* Initiate boot of the partition */
-	/*debug("Booting Partition %s", part_id);
+	debug("Booting Partition %s", part_id);
 	rc = pm_create_partition(part_id);
 	if (rc != STATUS_OK) {
 		error("Error booting_partition partition");
 		return(-1);
-		}*/
+	}
 
 	/* Wait for Partition to be booted */
 	rc = rm_get_partition(part_id, &bgl_record->bgl_part);
@@ -205,10 +205,11 @@ static int _post_allocate(bgl_record_t *bgl_record)
 		error("Error in GetPartition");
 		return(-1);
 	}
-	memset(command,0,100);
-	sprintf(command,"/home/da/allocate_block %s %s", part_id, USER_NAME);
-	system(command);
-
+	rm_free_partition(bgl_record->bgl_part);
+	/* memset(command,0,100); */
+/* 	sprintf(command,"/home/da/allocate_block %s %s", part_id, USER_NAME); */
+/* 	system(command); */
+/* 	sleep(5); */
 	rm_get_data(bgl_record->bgl_part, RM_PartitionID, &bgl_record->bgl_part_id);
 	bgl_record->node_use = bgl_record->node_use;
 	bgl_record->conn_type = bgl_record->conn_type;
@@ -933,7 +934,9 @@ int read_bgl_partitions()
 			break; 
 		}
 		//info("Node:%s in BglBlock:%s", node_name_tmp, part_id);
-
+		if(strncmp("RMP",part_id,3)) 
+			goto noadd;
+		//printf("no part_id of %s\n",part_id);
 		bgl_part_ptr = list_find_first(bgl_curr_part_list,
 					       _part_list_find, part_id);
 		if (!bgl_part_ptr) {
@@ -947,16 +950,16 @@ int read_bgl_partitions()
 			}
 			bgl_part_ptr = xmalloc(sizeof(bgl_record_t));
 			list_push(bgl_curr_part_list, bgl_part_ptr);
-
+				
 			bgl_part_ptr->bgl_part_list = list_create(NULL);
 			list_append(bgl_part_ptr->bgl_part_list, &pa_system_ptr->grid[bp_loc.X][bp_loc.Y][bp_loc.Z]);
-			
-                        bgl_part_ptr->bgl_part_id = xstrdup(part_id);
-			
-                        // need to get the 000x000 range for nodes
-                        // also need to get coords
-
-                        if ((rm_rc = rm_get_data(part_ptr,
+				
+			bgl_part_ptr->bgl_part_id = xstrdup(part_id);
+				
+			// need to get the 000x000 range for nodes
+			// also need to get coords
+				
+			if ((rm_rc = rm_get_data(part_ptr,
 						 RM_PartitionConnection,
 						 &bgl_part_ptr->conn_type))
 			    != STATUS_OK) {
@@ -972,33 +975,29 @@ int read_bgl_partitions()
 			if ((rm_rc = rm_get_data(part_ptr, 
 						 RM_PartitionUserName,
 						 &bgl_part_ptr->owner_name))
-                            != STATUS_OK) {
+			    != STATUS_OK) {
 				error("rm_get_data(RM_PartitionUserName): %s",
 				      bgl_err_str(rm_rc));
 			} 
-			
+				
 			if ((rm_rc = rm_get_data(part_ptr, 
 						 RM_PartitionBPNum,
 						 &bgl_part_ptr->bp_count))
-                            != STATUS_OK) {
+			    != STATUS_OK) {
 				error("rm_get_data(RM_PartitionUserName): %s",
 				      bgl_err_str(rm_rc));
 			} 
-
+				
 			if ((rm_rc = rm_get_data(part_ptr, 
 						 RM_PartitionSwitchNum,
 						 &bgl_part_ptr->switch_count))
-                            != STATUS_OK) {
+			    != STATUS_OK) {
 				error("rm_get_data(RM_PartitionUserName): %s",
 				      bgl_err_str(rm_rc));
 			} 
-
-			info("BglBlock:%s Conn:%s Use:%s Owner:%s", part_id, 
-			     convert_conn_type(bgl_part_ptr->conn_type),
-			     convert_node_use(bgl_part_ptr->node_use), 
-			     bgl_part_ptr->owner_name);
+				
 			bgl_part_ptr->part_lifecycle = STATIC;
-			
+				
 
 			if ((rm_rc = rm_free_partition(part_ptr))
 			    != STATUS_OK) {
@@ -1007,11 +1006,11 @@ int read_bgl_partitions()
 			}
 		
 
-                } else {
+		} else {
 			list_append(bgl_part_ptr->bgl_part_list, 
 				    &pa_system_ptr->grid[bp_loc.X][bp_loc.Y][bp_loc.Z]);			
 		}
-
+	noadd:
                 if ((rm_rc = rm_get_data(bgl, RM_NextBP, &bp_ptr))
 		    != STATUS_OK) {
 			error("rm_get_data(RM_NextBP): %s",
@@ -1031,13 +1030,14 @@ static int _post_bgl_init_read(void *object, void *arg)
 {
 	bgl_record_t *bgl_record = (bgl_record_t *) object;
 	pa_node_t* pa_node;
-	char name[10];
-	int start[PA_SYSTEM_DIMENSIONS] = {0}, end[PA_SYSTEM_DIMENSIONS] = {0};
+	char name[13];
+	int start[PA_SYSTEM_DIMENSIONS] = {8,8,8}, end[PA_SYSTEM_DIMENSIONS] = {0,0,0};
 	int dim;
 	ListIterator itr;
 	
 	itr = list_iterator_create(bgl_record->bgl_part_list);
 	while ((pa_node = (pa_node_t *) list_next(itr)) != NULL) {
+		
 		for(dim=0; dim<PA_SYSTEM_DIMENSIONS; dim++) {
 			if(pa_node->coord[dim] < start[dim])
 				start[dim] = pa_node->coord[dim];
@@ -1045,7 +1045,7 @@ static int _post_bgl_init_read(void *object, void *arg)
 				end[dim] = pa_node->coord[dim];
 		}	
 	}
-	sprintf(name, "bgl%d%d%dx%d%d%d",  
+	sprintf(name, "bgl[%d%d%dx%d%d%d]",  
 		start[X], start[Y], start[Z],
 		end[X], end[Y], end[Z]);
 	bgl_record->nodes = xstrdup(name);