diff --git a/NEWS b/NEWS
index 55ad93224cee5a8790e27a6c9642182c8bd8879c..0d2f383a7767bdcfe3f2a13ee10f34f7f9c084a6 100644
--- a/NEWS
+++ b/NEWS
@@ -151,7 +151,9 @@ documents those changes that are of interest to users and admins.
     TO OLDER VERSIONS OF SLURM FINE.
  -- Added configuration parameter BatchStartTimeout to control how long to 
     allow for a batch job prolog and environment loading (for Moab) to run.
-    See "man slurm.conf" for details.
+    Previously if job startup took too long, a batch job could be cancelled
+    before fully starting with a SlurmctldLog message of "Master node lost 
+    JobId=#, killing it".  See "man slurm.conf" for details.
  -- For a job step, add support for srun's --nodelist and --exclusive options
     to be used together.
  -- On slurmstepd failure, set node state to DRAIN rather than DOWN.
diff --git a/auxdir/x_ac_bluegene.m4 b/auxdir/x_ac_bluegene.m4
index cce4cd23c6cc62e4c4bece9d309705726865dd82..df505ca652b081c99a681e6ca299d52da386dc46 100644
--- a/auxdir/x_ac_bluegene.m4
+++ b/auxdir/x_ac_bluegene.m4
@@ -17,7 +17,7 @@ AC_DEFUN([X_AC_BGL],
 [
 	ac_bluegene_loaded=no
 
-   	AC_ARG_WITH(db2, AS_HELP_STRING(--with-db2-dir=PATH,Specify path to DB2 librarys parent directory), [ trydb2dir=$withval ])
+   	AC_ARG_WITH(db2-dir, AS_HELP_STRING(--with-db2-dir=PATH,Specify path to parent directory of DB2 library), [ trydb2dir=$withval ])
 
 	# test for bluegene emulation mode
 
@@ -36,7 +36,7 @@ AC_DEFUN([X_AC_BGL],
     	esac ])	
  	
 	if test "x$bluegene_emulation" = "xyes" -o "x$bgl_emulation" = "xyes"; then
-      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimentional architecture])
+      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
 		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
       		AC_DEFINE(HAVE_BGL, 1, [Define to 1 if emulating or running on Blue Gene/L system])
       		AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end only])
@@ -87,7 +87,7 @@ AC_DEFUN([X_AC_BGL],
 
   	if test ! -z "$have_bg_files" ; then
       		BG_INCLUDES="$bg_includes"
-      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimentional architecture])
+      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
       		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
       		AC_DEFINE(HAVE_BGL, 1, [Define to 1 if emulating or running on Blue Gene/L system])
       		AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end only])
@@ -122,7 +122,7 @@ AC_DEFUN([X_AC_BGP],
    	if test "x$ac_bluegene_loaded" = "xyes" ; then 
 		bg_default_dirs=""
 	elif test "x$bgp_emulation" = "xyes"; then
-      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimentional architecture])
+      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
 		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
       		AC_DEFINE(HAVE_BGP, 1, [Define to 1 if emulating or running on Blue Gene/P system])
       		AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end only])
@@ -167,7 +167,7 @@ AC_DEFUN([X_AC_BGP],
 
   	if test ! -z "$have_bgp_files" ; then
       		BG_INCLUDES="$bg_includes"
-      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimentional architecture])
+      		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
       		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
       		AC_DEFINE(HAVE_BGP, 1, [Define to 1 if emulating or running on Blue Gene/P system])
       		AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end only])
diff --git a/auxdir/x_ac_sun_const.m4 b/auxdir/x_ac_sun_const.m4
index 828e00e45153e6d3244c2a750b2aac7245e51a7e..c4c700b28d6ca30df2b03e051387bf3a6ace0477 100644
--- a/auxdir/x_ac_sun_const.m4
+++ b/auxdir/x_ac_sun_const.m4
@@ -26,7 +26,7 @@ AC_DEFUN([X_AC_SUN_CONST], [
 
   if test "$x_ac_sun_const" = yes; then
     AC_MSG_RESULT([yes])
-    AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimentional architecture])
+    AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
     AC_DEFINE(HAVE_SUN_CONST,1,[define if Sun Constellation system])
   else
     AC_MSG_RESULT([no])
diff --git a/config.h.in b/config.h.in
index 669a6e8a04131e857b685deee18c38e5a8ca97ad..6bcf4b9d79f6253e72ca65327baa90919e4d5caf 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,7 +15,7 @@
 /* Define to 1 if licensed under terms of the GNU General Public License. */
 #undef GPL_LICENSED
 
-/* Define to 1 if 3-dimentional architecture */
+/* Define to 1 if 3-dimensional architecture */
 #undef HAVE_3D
 
 /* Define to 1 for AIX operating system */
diff --git a/configure b/configure
index f05944cc301f5445f3349a0614ad0a12b2097f48..5c0f98072cd50ffb133b498c231f497ad90efdd1 100755
--- a/configure
+++ b/configure
@@ -1602,7 +1602,7 @@ Optional Packages:
   --with-tags[=TAGS]      include additional configurations [automatic]
   --with-cpusetdir=PATH   specify path to cpuset directory default is
                           /dev/cpuset
-  --with-db2-dir=PATH     Specify path to DB2 librarys parent directory
+  --with-db2-dir=PATH     Specify path to parent directory of DB2 library
   --with-bg-serial=NAME   set BG_SERIAL value
 
   --with-xcpu=PATH        specify path to XCPU directory
@@ -24742,9 +24742,9 @@ LIBS="$PTHREAD_LIBS $LIBS"
 	ac_bluegene_loaded=no
 
 
-# Check whether --with-db2 was given.
-if test "${with_db2+set}" = set; then
-  withval=$with_db2;  trydb2dir=$withval
+# Check whether --with-db2-dir was given.
+if test "${with_db2_dir+set}" = set; then
+  withval=$with_db2_dir;  trydb2dir=$withval
 fi
 
 
diff --git a/doc/man/man1/sacctmgr.1 b/doc/man/man1/sacctmgr.1
index 9d43a2282b7df932a6c5da5b5f76ca6096f39187..28412d566c0ca9ebe8052fe0be8ad639625d44f8 100644
--- a/doc/man/man1/sacctmgr.1
+++ b/doc/man/man1/sacctmgr.1
@@ -882,8 +882,8 @@ Comma separated list of Quality of Service names (Defined in sacctmgr).
 .br
 > sacctmgr create user name=adam cluster=tux account=physics fairshare=10
 .br
-> sacctmgr modify user name=adam cluster=tux account=physics set
-  maxjobs=2 maxtime=30:00
+> sacctmgr modify user where name=adam cluster=tux account=physics set
+  maxjobs=2 maxwall=30:00
 .br
 > sacctmgr list associations cluster=tux format=Account,Cluster,User,Fairshare tree withd
 .br
diff --git a/doc/man/man1/scancel.1 b/doc/man/man1/scancel.1
index da20d53677010628d3d06848d4a2c9ab00f02fae..0d6ec07915f42503df672805654b462074c2907f 100644
--- a/doc/man/man1/scancel.1
+++ b/doc/man/man1/scancel.1
@@ -58,7 +58,7 @@ If no signal is specified, the specified job or step will be terminated.
 
 .TP
 \fB\-t\fR, \fB\-\-state\fR=\fIjob_state_name\fR
-The state of the jobs are to be signaled. \fIjob_state_name\fR may have a value of 
+The state of the jobs to be signaled. \fIjob_state_name\fR may have a value of 
 either "PENDING", "RUNNING" or "SUSPENDED".
 
 .TP
@@ -89,9 +89,9 @@ The Slurm job ID to be signaled.
 \fIstep_id\fP
 The step ID of the job step to be signaled. 
 If not specified, the operation is performed at the level of a job.
-When \fB\-\-batch\fR is used, the batch shell processes will be signalled.
+When \fB\-\-batch\fR is used, the batch shell processes will be signaled.
 Otherwise the processes associated with all job steps, but not the 
-batch script itself, will be signalled.
+batch script itself, will be signaled.
 
 .SH "ENVIRONMENT VARIABLES"
 .PP
diff --git a/src/plugins/select/bluegene/plugin/bg_job_run.c b/src/plugins/select/bluegene/plugin/bg_job_run.c
index d0ca4e70e32bd9281218001ff473ae38719b100a..8ae2cc71242b61a43096d93748979675659b51e0 100644
--- a/src/plugins/select/bluegene/plugin/bg_job_run.c
+++ b/src/plugins/select/bluegene/plugin/bg_job_run.c
@@ -67,6 +67,8 @@
 #define MAX_POLL_RETRIES    220
 #define POLL_INTERVAL        3
 
+bool deleting_old_blocks_flag = 0;
+
 enum update_op {START_OP, TERM_OP, SYNC_OP};
 
 typedef struct bg_update {
@@ -665,9 +667,7 @@ static void _term_agent(bg_update_t *bg_update_ptr)
 	if ((rc = bridge_get_data(job_list, RM_JobListSize, &jobs)) != STATUS_OK) {
 		error("bridge_get_data(RM_JobListSize): %s", bg_err_str(rc));
 		jobs = 0;
-	} else if (jobs > 300)
-		fatal("Active job count (%d) invalid, restart MMCS", jobs);
-
+	}
 	debug2("job count %d",jobs);
 
 	for (i=0; i<jobs; i++) {		
@@ -759,11 +759,19 @@ static void _term_agent(bg_update_t *bg_update_ptr)
 		
 		slurm_mutex_unlock(&block_state_mutex);
 		
-	} else {
-		debug2("hopefully we are destroying this block %s "
+	} else if (bluegene_layout_mode == LAYOUT_DYNAMIC) {
+		debug2("Hopefully we are destroying this block %s "
 		       "since it isn't in the bg_list",
 		       bg_update_ptr->bg_block_id);
+	} else {
+		error("Could not find block %s previously assigned to job.  "
+		      "If this is happening at startup and you just changed "
+		      "your bluegene.conf this is expected.  Else you should "
+		      "probably restart your slurmctld since this shouldn't "
+		      "happen outside of that.",
+		      bg_update_ptr->bg_block_id);
 	}
+
 #ifdef HAVE_BG_FILES
 	if ((rc = bridge_free_job_list(job_list)) != STATUS_OK)
 		error("bridge_free_job_list(): %s", bg_err_str(rc));
diff --git a/src/plugins/select/bluegene/plugin/block_sys.c b/src/plugins/select/bluegene/plugin/block_sys.c
index 88537237b97144cb14d6113cb2b31093586a0221..21eff2b01da4169cd7fc46b3e9bf82dafd16018a 100755
--- a/src/plugins/select/bluegene/plugin/block_sys.c
+++ b/src/plugins/select/bluegene/plugin/block_sys.c
@@ -38,6 +38,7 @@
 
 #include "bluegene.h"
 #include "src/common/uid.h"
+#include <fcntl.h>
 
 /** these are used in the dynamic partitioning algorithm */
 
@@ -247,7 +248,7 @@ static int _post_allocate(bg_record_t *bg_record)
 			temp = atoi(bg_record->bg_block_id+i)+1;
 			if(temp > block_inx)
 				block_inx = temp;
-			info("first new block inx will now be %d", block_inx);
+			debug4("first new block inx will now be %d", block_inx);
 		}
 	} else {
 		bg_record->bg_block_id = xmalloc(8);
@@ -888,5 +889,257 @@ int read_bg_blocks()
 	return rc;
 }
 
+#else
+
+extern int load_state_file(char *dir_name)
+{
+	int state_fd, i, j=0;
+	char *state_file = NULL;
+	Buf buffer = NULL;
+	char *data = NULL;
+	int data_size = 0;
+	node_select_info_msg_t *node_select_ptr = NULL;
+	bg_record_t *bg_record = NULL;
+	bg_info_record_t *bg_info_record = NULL;
+	bitstr_t *node_bitmap = NULL, *ionode_bitmap = NULL;
+	int geo[BA_SYSTEM_DIMENSIONS];
+	char temp[256];
+	List results = NULL;
+	int data_allocated, data_read = 0;
+	char *ver_str = NULL;
+	uint32_t ver_str_len;
+	int blocks = 0;
+	uid_t my_uid;
+	int ionodes = 0;
+	char *name = NULL;
+
+	if(!dir_name) {
+		debug2("Starting bluegene with clean slate");
+		return SLURM_SUCCESS;
+	}
+
+	xassert(bg_curr_block_list);
+
+	state_file = xstrdup(dir_name);
+	xstrcat(state_file, "/block_state");
+	state_fd = open(state_file, O_RDONLY);
+	if(state_fd < 0) {
+		error("No block state file (%s) to recover", state_file);
+		xfree(state_file);
+		return SLURM_SUCCESS;
+	} else {
+		data_allocated = BUF_SIZE;
+		data = xmalloc(data_allocated);
+		while (1) {
+			data_read = read(state_fd, &data[data_size],
+					 BUF_SIZE);
+			if (data_read < 0) {
+				if (errno == EINTR)
+					continue;
+				else {
+					error("Read error on %s: %m", 
+					      state_file);
+					break;
+				}
+			} else if (data_read == 0)	/* eof */
+				break;
+			data_size      += data_read;
+			data_allocated += data_read;
+			xrealloc(data, data_allocated);
+		}
+		close(state_fd);
+	}
+	xfree(state_file);
+
+	buffer = create_buf(data, data_size);
+
+	/*
+	 * Check the data version so that when the format changes, we 
+	 * we don't try to unpack data using the wrong format routines
+	 */
+	if(size_buf(buffer)
+	   >= sizeof(uint32_t) + strlen(BLOCK_STATE_VERSION)) {
+	        char *ptr = get_buf_data(buffer);
+		if (!memcmp(&ptr[sizeof(uint32_t)], BLOCK_STATE_VERSION, 3)) {
+		        safe_unpackstr_xmalloc(&ver_str, &ver_str_len, buffer);
+		        debug3("Version string in block_state header is %s",
+			       ver_str);
+		}
+	}
+	if (ver_str && (strcmp(ver_str, BLOCK_STATE_VERSION) != 0)) {
+		error("Can not recover block state, "
+		      "data version incompatable");
+		xfree(ver_str);
+		free_buf(buffer);
+		return EFAULT;
+	}
+	xfree(ver_str);
+	if(select_g_unpack_node_info(&node_select_ptr, buffer) == SLURM_ERROR) {
+		error("select_p_state_restore: problem unpacking node_info");
+		goto unpack_error;
+	}
+	slurm_mutex_lock(&block_state_mutex);
+	reset_ba_system(false);
+
+	node_bitmap = bit_alloc(node_record_count);	
+	ionode_bitmap = bit_alloc(bluegene_numpsets);	
+	for (i=0; i<node_select_ptr->record_count; i++) {
+		bg_info_record = &(node_select_ptr->bg_info_array[i]);
+		
+		bit_nclear(node_bitmap, 0, bit_size(node_bitmap) - 1);
+		bit_nclear(ionode_bitmap, 0, bit_size(ionode_bitmap) - 1);
+		
+		j = 0;
+		while(bg_info_record->bp_inx[j] >= 0) {
+			if (bg_info_record->bp_inx[j+1]
+			    >= node_record_count) {
+				fatal("Job state recovered incompatable with "
+					"bluegene.conf. bp=%u state=%d",
+					node_record_count,
+					bg_info_record->bp_inx[j+1]);
+			}
+			bit_nset(node_bitmap,
+				 bg_info_record->bp_inx[j],
+				 bg_info_record->bp_inx[j+1]);
+			j += 2;
+		}		
+
+		j = 0;
+		while(bg_info_record->ionode_inx[j] >= 0) {
+			if (bg_info_record->ionode_inx[j+1]
+			    >= bluegene_numpsets) {
+				fatal("Job state recovered incompatable with "
+					"bluegene.conf. ionodes=%u state=%d",
+					bluegene_numpsets,
+					bg_info_record->ionode_inx[j+1]);
+			}
+			bit_nset(ionode_bitmap,
+				 bg_info_record->ionode_inx[j],
+				 bg_info_record->ionode_inx[j+1]);
+			j += 2;
+		}		
+					
+		bg_record = xmalloc(sizeof(bg_record_t));
+		bg_record->bg_block_id =
+			xstrdup(bg_info_record->bg_block_id);
+		bg_record->nodes =
+			xstrdup(bg_info_record->nodes);
+		bg_record->ionodes =
+			xstrdup(bg_info_record->ionodes);
+		bg_record->ionode_bitmap = bit_copy(ionode_bitmap);
+		bg_record->state = bg_info_record->state;
+#ifdef HAVE_BGL
+		bg_record->quarter = bg_info_record->quarter;
+		bg_record->nodecard = bg_info_record->nodecard;
+#endif
+		if(bg_info_record->state == RM_PARTITION_ERROR)
+			bg_record->job_running = BLOCK_ERROR_STATE;
+		else
+			bg_record->job_running = NO_JOB_RUNNING;
+		bg_record->bp_count = bit_size(node_bitmap);
+		bg_record->node_cnt = bg_info_record->node_cnt;
+		if(bluegene_bp_node_cnt > bg_record->node_cnt) {
+			ionodes = bluegene_bp_node_cnt 
+				/ bg_record->node_cnt;
+			bg_record->cpus_per_bp =
+				procs_per_node / ionodes;
+		} else {
+			bg_record->cpus_per_bp = procs_per_node;
+		}
+#ifdef HAVE_BGL
+		bg_record->node_use = bg_info_record->node_use;
 #endif
+		bg_record->conn_type = bg_info_record->conn_type;
+		bg_record->boot_state = 0;
 
+		process_nodes(bg_record, true);
+
+		bg_record->target_name = xstrdup(bg_slurm_user_name);
+		bg_record->user_name = xstrdup(bg_slurm_user_name);
+			
+		my_uid = uid_from_string(bg_record->user_name);
+		if (my_uid == (uid_t) -1) {
+			error("uid_from_strin(%s): %m", 
+			      bg_record->user_name);
+		} else {
+			bg_record->user_uid = my_uid;
+		} 
+				
+#ifdef HAVE_BGL
+		bg_record->blrtsimage =
+			xstrdup(bg_info_record->blrtsimage);
+#endif
+		bg_record->linuximage = 
+			xstrdup(bg_info_record->linuximage);
+		bg_record->mloaderimage =
+			xstrdup(bg_info_record->mloaderimage);
+		bg_record->ramdiskimage =
+			xstrdup(bg_info_record->ramdiskimage);
+
+		for(j=0; j<BA_SYSTEM_DIMENSIONS; j++) 
+			geo[j] = bg_record->geo[j];
+				
+		if(bluegene_layout_mode == LAYOUT_OVERLAP) 
+			reset_ba_system(false);
+		results = list_create(NULL);
+		name = set_bg_block(results,
+				    bg_record->start, 
+				    geo, 
+				    bg_record->conn_type);
+		if(!name) {
+			error("I was unable to "
+			      "make the "
+			      "requested block.");
+			list_destroy(results);
+			destroy_bg_record(bg_record);
+			continue;
+		}
+
+			
+		snprintf(temp, sizeof(temp), "%s%s",
+			 bg_slurm_node_prefix,
+			 name);
+		
+		xfree(name);
+		if(strcmp(temp, bg_record->nodes)) {
+			fatal("bad wiring in preserved state "
+			      "(found %s, but allocated %s) "
+			      "YOU MUST COLDSTART",
+			      bg_record->nodes, temp);
+		}
+		if(bg_record->bg_block_list)
+			list_destroy(bg_record->bg_block_list);
+		bg_record->bg_block_list =
+			list_create(destroy_ba_node);
+		copy_node_path(results, &bg_record->bg_block_list);
+		list_destroy(results);			
+			
+		configure_block(bg_record);
+		blocks++;
+		list_push(bg_curr_block_list, bg_record);		
+		if(bluegene_layout_mode == LAYOUT_DYNAMIC) {
+			bg_record_t *tmp_record = xmalloc(sizeof(bg_record_t));
+			copy_bg_record(bg_record, tmp_record);
+			list_push(bg_list, tmp_record);
+		}
+	}
+
+	FREE_NULL_BITMAP(ionode_bitmap);
+	FREE_NULL_BITMAP(node_bitmap);
+
+	sort_bg_record_inc_size(bg_curr_block_list);
+	slurm_mutex_unlock(&block_state_mutex);
+		
+	info("Recovered %d blocks", blocks);
+	select_g_free_node_info(&node_select_ptr);
+	free_buf(buffer);
+
+	return SLURM_SUCCESS;
+
+unpack_error:
+	error("Incomplete block data checkpoint file");
+	free_buf(buffer);
+	return SLURM_FAILURE;
+}
+
+#endif
diff --git a/src/plugins/select/bluegene/plugin/bluegene.c b/src/plugins/select/bluegene/plugin/bluegene.c
index cde6ecfd8d3911cbcb6d6eb91f7a6541bef33563..050863ee17c49fca8371bd88f185e2267a02624c 100644
--- a/src/plugins/select/bluegene/plugin/bluegene.c
+++ b/src/plugins/select/bluegene/plugin/bluegene.c
@@ -112,7 +112,7 @@ int max_dim[BA_SYSTEM_DIMENSIONS] = { 0 };
 
 
 static void _set_bg_lists();
-static int  _validate_config_nodes(List *bg_found_block_list);
+static int  _validate_config_nodes(List *bg_found_block_list, char *dir);
 static int _delete_old_blocks(List bg_found_block_list);
 static char *_get_bg_conf(void);
 static int  _reopen_bridge_log(void);
@@ -943,8 +943,6 @@ extern int read_bg_conf(void)
 	static time_t last_config_update = (time_t) 0;
 	struct stat config_stat;
 	ListIterator itr = NULL;
-	/* found bg blocks already on system */
-	List bg_found_block_list = list_create(NULL);
 	
 	debug("Reading the bluegene.conf file");
 
@@ -1334,9 +1332,25 @@ extern int read_bg_conf(void)
 			add_bg_record(bg_list, NULL, blockreq_array[i]);
 		}
 	}
+	s_p_hashtbl_destroy(tbl);
+
+	return SLURM_SUCCESS;
+}
+
+extern int validate_current_blocks(char *dir)
+{
+	/* found bg blocks already on system */
+	List bg_found_block_list = list_create(NULL);
+	static time_t last_config_update = (time_t) 0;
+
+	/* only run on startup */
+	if(last_config_update)
+		return SLURM_SUCCESS;
+
+	last_config_update = time(NULL);
 //#if 0	
 	/* Check to see if the configs we have are correct */
-	if (_validate_config_nodes(&bg_found_block_list) == SLURM_ERROR) { 
+	if (_validate_config_nodes(&bg_found_block_list, dir) == SLURM_ERROR) { 
 		_delete_old_blocks(bg_found_block_list);
 	}
 //#endif
@@ -1369,8 +1383,6 @@ extern int read_bg_conf(void)
 	sort_bg_record_inc_size(bg_list);
 	slurm_mutex_unlock(&block_state_mutex);
 	debug("Blocks have finished being created.");
-	s_p_hashtbl_destroy(tbl);
-
 	return SLURM_SUCCESS;
 }
 
@@ -1390,7 +1402,6 @@ static void _set_bg_lists()
 		list_destroy(bg_curr_block_list);	
 	bg_curr_block_list = list_create(destroy_bg_record);
 	
-	
 	if(bg_list) 
 		list_destroy(bg_list);
 	bg_list = list_create(destroy_bg_record);
@@ -1423,10 +1434,9 @@ static void _set_bg_lists()
  * code. Writes bg_block_id into bg_list records.
  */
 
-static int _validate_config_nodes(List *bg_found_block_list)
+static int _validate_config_nodes(List *bg_found_block_list, char *dir)
 {
 	int rc = SLURM_ERROR;
-#ifdef HAVE_BG_FILES
 	bg_record_t* bg_record = NULL;	
 	bg_record_t* init_bg_record = NULL;
 	bg_record_t* full_system_bg_record = NULL;	
@@ -1435,10 +1445,19 @@ static int _validate_config_nodes(List *bg_found_block_list)
 	ListIterator itr_curr;
 	char tmp_char[256];
 
-	/* read current bg block info into bg_curr_block_list */
+#ifdef HAVE_BG_FILES
+	/* read current bg block info into bg_curr_block_list This
+	 * happens in the state load before this in emulation mode */
 	if (read_bg_blocks() == SLURM_ERROR)
 		return SLURM_ERROR;
-	
+#else
+	/* read in state from last run.  Only for emulation mode */
+	if ((rc = load_state_file(dir)) != SLURM_SUCCESS)
+		return rc;
+	/* This needs to be reset to SLURM_ERROR or it will never we
+	   that way again ;). */
+	rc = SLURM_ERROR;
+#endif	
 	if(!bg_recover) 
 		return SLURM_ERROR;
 
@@ -1452,7 +1471,6 @@ static int _validate_config_nodes(List *bg_found_block_list)
 	
 	if(!*bg_found_block_list)
 		(*bg_found_block_list) = list_create(NULL);
-
 	
 	itr_conf = list_iterator_create(bg_list);
 	while ((bg_record = (bg_record_t*) list_next(itr_conf))) {
@@ -1461,7 +1479,7 @@ static int _validate_config_nodes(List *bg_found_block_list)
 		   search here 
 		*/
 		list_iterator_reset(itr_curr);
-		while ((init_bg_record = list_next(itr_curr))) {
+		while ((init_bg_record = list_next(itr_curr))) {		
 			if (strcasecmp(bg_record->nodes, 
 				       init_bg_record->nodes))
 				continue; /* wrong nodes */
@@ -1497,8 +1515,7 @@ static int _validate_config_nodes(List *bg_found_block_list)
 				      init_bg_record->ramdiskimage))
 				continue;
 		       			
-			copy_bg_record(init_bg_record, 
-				       bg_record);
+			copy_bg_record(init_bg_record, bg_record);
 			break;
 		}
 			
@@ -1553,14 +1570,11 @@ finished:
 	if(list_count(bg_list) == list_count(bg_curr_block_list))
 		rc = SLURM_SUCCESS;
 	
-#endif
-
 	return rc;
 }
 
 static int _delete_old_blocks(List bg_found_block_list)
 {
-#ifdef HAVE_BG_FILES
 	ListIterator itr_curr, itr_found;
 	bg_record_t *found_record = NULL, *init_record = NULL;
 	pthread_attr_t attr_agent;
@@ -1631,7 +1645,7 @@ static int _delete_old_blocks(List bg_found_block_list)
 	if ((bg_destroy_block_list == NULL) 
 	    && ((bg_destroy_block_list = list_create(NULL)) == NULL))
 		fatal("malloc failure in block_list");
-		
+
 	itr_curr = list_iterator_create(bg_destroy_list);
 	while ((init_record = (bg_record_t*) list_next(itr_curr))) {
 		list_push(bg_destroy_block_list, init_record);
@@ -1680,7 +1694,7 @@ static int _delete_old_blocks(List bg_found_block_list)
 	}
 	
 	info("I am done deleting");
-#endif	
+
 	return SLURM_SUCCESS;
 }
 
diff --git a/src/plugins/select/bluegene/plugin/bluegene.h b/src/plugins/select/bluegene/plugin/bluegene.h
index 2f2756be22d568671bdb3817c64fafe6c9851c8f..db454b73f3fa84d7893e228b2426a0acabfab046 100644
--- a/src/plugins/select/bluegene/plugin/bluegene.h
+++ b/src/plugins/select/bluegene/plugin/bluegene.h
@@ -108,6 +108,9 @@ extern int num_unused_cpus;
 #define MAX_AGENT_COUNT      30
 #define BUFSIZE 4096
 #define BITSIZE 128
+/* Change BLOCK_STATE_VERSION value when changing the state save
+ * format i.e. pack_block() */
+#define BLOCK_STATE_VERSION      "VER001"
 
 #include "bg_block_info.h"
 #include "bg_job_place.h"
@@ -160,11 +163,13 @@ extern void *mult_free_block(void *args);
 extern void *mult_destroy_block(void *args);
 extern int free_block_list(List delete_list);
 extern int read_bg_conf(void);
+extern int validate_current_blocks(char *dir);
 
 /* block_sys.c */
 /*****************************************************/
 extern int configure_block(bg_record_t * bg_conf_record);
 extern int read_bg_blocks();
+extern int load_state_file(char *dir_name);
 
 /* bg_switch_connections.c */
 /*****************************************************/
diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c
index 49bb739b10acd2ff413dec65069b858ce33c1da5..0312f6d1c04bd1e08007a08556f24a3bf7e95874 100644
--- a/src/plugins/select/bluegene/plugin/select_bluegene.c
+++ b/src/plugins/select/bluegene/plugin/select_bluegene.c
@@ -42,15 +42,11 @@
 #include "defined_block.h"
 #endif
 
-#include "src/common/uid.h"
+//#include "src/common/uid.h"
 #include "src/slurmctld/trigger_mgr.h"
 #include <fcntl.h>
- 
-#define HUGE_BUF_SIZE (1024*16)
 
-/* Change BLOCK_STATE_VERSION value when changing the state save
- * format i.e. pack_block() */
-#define BLOCK_STATE_VERSION      "VER001"
+#define HUGE_BUF_SIZE (1024*16)
 
 /* global */
 int procs_per_node = 512;
@@ -358,293 +354,9 @@ extern int select_p_state_save(char *dir_name)
 
 extern int select_p_state_restore(char *dir_name)
 {
-	int error_code = SLURM_SUCCESS;
-	int state_fd, i, j=0;
-	char *state_file = NULL;
-	Buf buffer = NULL;
-	char *data = NULL;
-	int data_size = 0;
-	node_select_info_msg_t *node_select_ptr = NULL;
-	ListIterator itr;
-	bg_record_t *bg_record = NULL;
-	bg_info_record_t *bg_info_record = NULL;
-	bitstr_t *node_bitmap = NULL, *ionode_bitmap = NULL;
-	int geo[BA_SYSTEM_DIMENSIONS];
-	char temp[256];
-	List results = NULL;
-	int data_allocated, data_read = 0;
-	char *ver_str = NULL;
-	uint32_t ver_str_len;
-	int blocks = 0;
-	uid_t my_uid;
-
 	debug("bluegene: select_p_state_restore");
-#ifdef HAVE_BG_FILES
-	debug("This doesn't do anything on a real bluegene system");
-	return SLURM_SUCCESS;
-#endif
-	if(!dir_name) {
-		debug2("Starting bluegene with clean slate");
-		return SLURM_SUCCESS;
-	}
-	state_file = xstrdup(dir_name);
-	xstrcat(state_file, "/block_state");
-	state_fd = open(state_file, O_RDONLY);
-	if(state_fd < 0) {
-		error("No block state file (%s) to recover", state_file);
-		xfree(state_file);
-		return SLURM_SUCCESS;
-	} else {
-		data_allocated = BUF_SIZE;
-		data = xmalloc(data_allocated);
-		while (1) {
-			data_read = read(state_fd, &data[data_size],
-					 BUF_SIZE);
-			if (data_read < 0) {
-				if (errno == EINTR)
-					continue;
-				else {
-					error("Read error on %s: %m", 
-					      state_file);
-					break;
-				}
-			} else if (data_read == 0)	/* eof */
-				break;
-			data_size      += data_read;
-			data_allocated += data_read;
-			xrealloc(data, data_allocated);
-		}
-		close(state_fd);
-	}
-	xfree(state_file);
-
-	buffer = create_buf(data, data_size);
-
-	/*
-	 * Check the data version so that when the format changes, we 
-	 * we don't try to unpack data using the wrong format routines
-	 */
-	if(size_buf(buffer)
-	   >= sizeof(uint32_t) + strlen(BLOCK_STATE_VERSION)) {
-	        char *ptr = get_buf_data(buffer);
-		if (!memcmp(&ptr[sizeof(uint32_t)], BLOCK_STATE_VERSION, 3)) {
-		        safe_unpackstr_xmalloc(&ver_str, &ver_str_len, buffer);
-		        debug3("Version string in block_state header is %s",
-			       ver_str);
-		}
-	}
-	if (ver_str && (strcmp(ver_str, BLOCK_STATE_VERSION) != 0)) {
-		error("Can not recover block state, "
-		      "data version incompatable");
-		xfree(ver_str);
-		free_buf(buffer);
-		return EFAULT;
-	}
-	xfree(ver_str);
-	if(select_g_unpack_node_info(&node_select_ptr, buffer) == SLURM_ERROR) {
-		error("select_p_state_restore: problem unpacking node_info");
-		goto unpack_error;
-	}
-	slurm_mutex_lock(&block_state_mutex);
-	reset_ba_system(false);
-
-	node_bitmap = bit_alloc(node_record_count);	
-	ionode_bitmap = bit_alloc(bluegene_numpsets);	
-	itr = list_iterator_create(bg_list);
-	for (i=0; i<node_select_ptr->record_count; i++) {
-		bg_info_record = &(node_select_ptr->bg_info_array[i]);
-		
-		bit_nclear(node_bitmap, 0, bit_size(node_bitmap) - 1);
-		bit_nclear(ionode_bitmap, 0, bit_size(ionode_bitmap) - 1);
-		
-		j = 0;
-		while(bg_info_record->bp_inx[j] >= 0) {
-			if (bg_info_record->bp_inx[j+1]
-			    >= node_record_count) {
-				fatal("Job state recovered incompatable with "
-					"bluegene.conf. bp=%u state=%d",
-					node_record_count,
-					bg_info_record->bp_inx[j+1]);
-			}
-			bit_nset(node_bitmap,
-				 bg_info_record->bp_inx[j],
-				 bg_info_record->bp_inx[j+1]);
-			j += 2;
-		}		
-
-		j = 0;
-		while(bg_info_record->ionode_inx[j] >= 0) {
-			if (bg_info_record->ionode_inx[j+1]
-			    >= bluegene_numpsets) {
-				fatal("Job state recovered incompatable with "
-					"bluegene.conf. ionodes=%u state=%d",
-					bluegene_numpsets,
-					bg_info_record->ionode_inx[j+1]);
-			}
-			bit_nset(ionode_bitmap,
-				 bg_info_record->ionode_inx[j],
-				 bg_info_record->ionode_inx[j+1]);
-			j += 2;
-		}		
-					
-		while((bg_record = list_next(itr))) {
-			if(bit_equal(bg_record->bitmap, node_bitmap)
-			   && bit_equal(bg_record->ionode_bitmap,
-					ionode_bitmap))
-				break;			
-		}
-
-		list_iterator_reset(itr);
-		if(bg_record) {
-			if(bg_info_record->state == RM_PARTITION_ERROR)
-				bg_record->job_running = BLOCK_ERROR_STATE;
-			bg_record->state = bg_info_record->state;
-			blocks++;
-		} else {
-			int ionodes = 0;
-			char *name = NULL;
-			/* make the record that wasn't there (only for
-			 * dynamic systems that are in emulation mode */
-#ifdef HAVE_BG_FILES
-			error("Previous block %s is gone, not adding.",
-			      bg_info_record->bg_block_id);
-			continue;
-#endif
-			if(bluegene_layout_mode != LAYOUT_DYNAMIC) {
-				error("Evidently we found a block (%s) which "
-				      "we had before but no longer care about. "
-				      "We are not adding it since we aren't "
-				      "using Dynamic mode",
-				      bg_info_record->bg_block_id);
-				continue;
-			}
 	
-			bg_record = xmalloc(sizeof(bg_record_t));
-			bg_record->bg_block_id =
-				xstrdup(bg_info_record->bg_block_id);
-			bg_record->nodes =
-				xstrdup(bg_info_record->nodes);
-			bg_record->ionodes =
-				xstrdup(bg_info_record->ionodes);
-			bg_record->ionode_bitmap = bit_copy(ionode_bitmap);
-			bg_record->state = bg_info_record->state;
-#ifdef HAVE_BGL
-			bg_record->quarter = bg_info_record->quarter;
-			bg_record->nodecard = bg_info_record->nodecard;
-#endif
-			if(bg_info_record->state == RM_PARTITION_ERROR)
-				bg_record->job_running = BLOCK_ERROR_STATE;
-			else
-				bg_record->job_running = NO_JOB_RUNNING;
-			bg_record->bp_count = bit_size(node_bitmap);
-			bg_record->node_cnt = bg_info_record->node_cnt;
-			if(bluegene_bp_node_cnt > bg_record->node_cnt) {
-				ionodes = bluegene_bp_node_cnt 
-					/ bg_record->node_cnt;
-				bg_record->cpus_per_bp =
-					procs_per_node / ionodes;
-			} else {
-				bg_record->cpus_per_bp = procs_per_node;
-			}
-#ifdef HAVE_BGL
-			bg_record->node_use = bg_info_record->node_use;
-#endif
-			bg_record->conn_type = bg_info_record->conn_type;
-			bg_record->boot_state = 0;
-
-			process_nodes(bg_record, true);
-
-			
-			bg_record->target_name = 
-				xstrdup(bg_slurm_user_name);
-			bg_record->user_name = 
-				xstrdup(bg_slurm_user_name);
-			
-			my_uid = uid_from_string(bg_record->user_name);
-			if (my_uid == (uid_t) -1) {
-				error("uid_from_strin(%s): %m", 
-				      bg_record->user_name);
-			} else {
-				bg_record->user_uid = my_uid;
-			} 
-				
-#ifdef HAVE_BGL
-			bg_record->blrtsimage =
-				xstrdup(bg_info_record->blrtsimage);
-#endif
-			bg_record->linuximage = 
-				xstrdup(bg_info_record->linuximage);
-			bg_record->mloaderimage =
-				xstrdup(bg_info_record->mloaderimage);
-			bg_record->ramdiskimage =
-				xstrdup(bg_info_record->ramdiskimage);
-
-			for(j=0; j<BA_SYSTEM_DIMENSIONS; j++) 
-				geo[j] = bg_record->geo[j];
-				
-			results = list_create(NULL);
-			name = set_bg_block(results,
-					    bg_record->start, 
-					    geo, 
-					    bg_record->conn_type);
-			if(!name) {
-				error("I was unable to "
-				      "make the "
-				      "requested block.");
-				list_destroy(results);
-				destroy_bg_record(bg_record);
-				continue;
-			}
-
-			
-			snprintf(temp, sizeof(temp), "%s%s",
-				 bg_slurm_node_prefix,
-				 name);
-			
-
-			xfree(name);
-			if(strcmp(temp, bg_record->nodes)) {
-#ifdef HAVE_BG_FILES
-				fatal("given list of %s "
-				      "but allocated %s, "
-				      "your order might be "
-				      "wrong in bluegene.conf",
-				      bg_record->nodes, temp);
-#else
-				fatal("bad wiring in preserved state "
-				      "(found %s, but allocated %s) "
-				      "YOU MUST COLDSTART",
-				      bg_record->nodes, temp);
-#endif
-			}
-			if(bg_record->bg_block_list)
-				list_destroy(bg_record->bg_block_list);
-			bg_record->bg_block_list =
-				list_create(destroy_ba_node);
-			copy_node_path(results, &bg_record->bg_block_list);
-			list_destroy(results);			
-			
-			configure_block(bg_record);
-			blocks++;
-			list_push(bg_list, bg_record);		
-		}
-	}
-	FREE_NULL_BITMAP(ionode_bitmap);
-	FREE_NULL_BITMAP(node_bitmap);
-	list_iterator_destroy(itr);
-
-	sort_bg_record_inc_size(bg_list);
-	slurm_mutex_unlock(&block_state_mutex);
-		
-	info("Recovered %d blocks", blocks);
-	select_g_free_node_info(&node_select_ptr);
-	free_buf(buffer);
-	return error_code;
-
-unpack_error:
-	error("Incomplete block data checkpoint file");
-	free_buf(buffer);
-	return SLURM_FAILURE;
+	return validate_current_blocks(dir_name);
 }
 
 /* Sync BG blocks to currently active jobs */
diff --git a/src/scancel/opt.c b/src/scancel/opt.c
index 2d536fcae06695223f342efa38d07627ed9ed555..365a753ca3b8e0eacde02aea664bd3ff28125c76 100644
--- a/src/scancel/opt.c
+++ b/src/scancel/opt.c
@@ -507,14 +507,14 @@ static void _help(void)
 	printf("  -b, --batch                     signal batch shell for specified job\n");
 /*	printf("      --ctld                      route request through slurmctld\n"); */
 	printf("  -i, --interactive               require response from user for each job\n");
-	printf("  -n, --name=job_name             name of job to be signalled\n");
+	printf("  -n, --name=job_name             name of job to be signaled\n");
 	printf("  -p, --partition=partition       name of job's partition\n");
 	printf("  -q, --quiet                     disable warnings\n");
 	printf("  -s, --signal=name | integer     signal to send to job, default is SIGKILL\n");
-	printf("  -t, --states=states             states to jobs to cancel,\n");
-	printf("                                  default is pending, running, and\n");
-	printf("                                  suspended\n");
-	printf("  -u, --user=user                 name or id of user to have jobs cancelled\n");
+	printf("  -t, --state=state               state of the jobs to be signaled\n");
+	printf("                                  valid options are either pending,\n");
+	printf("                                  running, or suspended\n");
+	printf("  -u, --user=user                 name or id of user to have jobs signaled\n");
 	printf("  -v, --verbose                   verbosity level\n");
 	printf("  -V, --version                   output version information and exit\n");
 	printf("\nHelp options:\n");
diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index e20d0207da390132b7eb642c7cb6e38474beff72..2f16e1c18422a4bd617b3a64f321a8f8cbd40918 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -1188,8 +1188,10 @@ static void *_slurmctld_background(void *no_data)
 				lock_slurmctld(node_write_lock);
 				ping_nodes();
 				unlock_slurmctld(node_write_lock);
-			} else if (!msg_sent) {
-				/* log failure once per ping_nodes() call */
+			} else if ((!msg_sent) && (!ping_nodes_now)) {
+				/* log failure once per ping_nodes() call,
+				 * no error if node state update request
+				 * processed while the ping is in progress */
 				error("Node ping apparently hung, "
 				      "many nodes may be DOWN or configured "
 				      "SlurmdTimeout should be increased");
diff --git a/testsuite/expect/Makefile.am b/testsuite/expect/Makefile.am
index 2e1df680d301bf747c1c6b7d1e82834658893a9d..814eba7a1d8aecdccdf7838c2440787d61b04a77 100644
--- a/testsuite/expect/Makefile.am
+++ b/testsuite/expect/Makefile.am
@@ -10,6 +10,7 @@ EXTRA_DIST = \
 	mpi-testscripts/Makefile	\
 	mpi-testscripts/script.slurm.sh	\
 	globals				\
+	globals_accounting		\
 	pkill				\
 	README				\
 	regression			\
diff --git a/testsuite/expect/Makefile.in b/testsuite/expect/Makefile.in
index 374f6fac783202d078beab45ba57e66ec81c491b..8986eb0605cc2e3750498a48abc11c8ec19ce1d2 100644
--- a/testsuite/expect/Makefile.in
+++ b/testsuite/expect/Makefile.in
@@ -248,6 +248,7 @@ EXTRA_DIST = \
 	mpi-testscripts/Makefile	\
 	mpi-testscripts/script.slurm.sh	\
 	globals				\
+	globals_accounting		\
 	pkill				\
 	README				\
 	regression			\
diff --git a/testsuite/expect/README b/testsuite/expect/README
index fd0b850b56fb756e2c33700a2fceacb8ab0bc4e6..6ed40b2d2a3e4b9de36bd53960af2ff48ff08c63 100644
--- a/testsuite/expect/README
+++ b/testsuite/expect/README
@@ -521,3 +521,8 @@ test21.21  sacctmgr add an account to this cluster and try using it with
 test21.22  sacctmgr load file
 test21.23  sacctmgr wckey
 test21.24  sacctmgr dump file
+
+test22.#   Testing of sreport commands and options. 
+           These also test the sacctmgr archive dump/load functions.
+=================================================
+test22.1   sreport cluster ut report
diff --git a/testsuite/expect/globals_accounting b/testsuite/expect/globals_accounting
new file mode 100644
index 0000000000000000000000000000000000000000..1a43e68c671fc18794ec9d09181172601b4cd17d
--- /dev/null
+++ b/testsuite/expect/globals_accounting
@@ -0,0 +1,1365 @@
+#!/usr/bin/expect
+############################################################################
+# Purpose: Establish global state information for SLURM test suite
+#
+# To define site-specific state information, set the values in a file
+# named 'globals.local'. Those values will override any specified here.
+# for example:
+#
+# $ cat globals.local
+# set slurm_dir "/usr/local"
+# set mpicc     "/usr/local/bin/mpicc"
+#
+############################################################################
+# Copyright (C) 2008 Lawrence Livermore National Security.
+# Copyright (C) 2002-2007 The Regents of the University of California.
+# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+# Written by Morris Jette <jette1@llnl.gov>
+# Additions by Joseph Donaghy <donaghy1@llnl.gov>
+# LLNL-CODE-402394.
+# 
+# This file is part of SLURM, a resource management program.
+# For details, see <http://www.llnl.gov/linux/slurm/>.
+#  
+# SLURM is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+# 
+# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with SLURM; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
+############################################################################
+
+source ./globals
+
+set timeout 60
+
+#
+# Use sacctmgr to create a cluster
+#	
+proc add_cluster {name qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall} {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to add\n"
+		return 1
+	}
+
+	set command "$name"
+
+	if { [string length $fairshare] } {
+		set command "$command fairshare=$fairshare"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpumin] } {
+		set command "$command GrpCPUMins=$grpcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpu] } {
+		set command "$command GrpCPUs=$grpcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpjob] } {
+		set command "$command GrpJobs=$grpjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpnode] } {
+		set command "$command GrpNodes=$grpnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpsubmit] } {
+		set command "$command GrpSubmitJobs=$grpsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpwall] } {
+		set command "$command GrpWall=$grpwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpumin] } {
+		set command "$command MaxCPUMins=$maxcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpu] } {
+		set command "$command MaxCPUs=$maxcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxjob] } {
+		set command "$command MaxJobs=$maxjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxnode] } {
+		set command "$command MaxNodes=$maxnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxsubmit] } {
+		set command "$command MaxSubmitJobs=$maxsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxwall] } {
+		set command "$command MaxWall=$maxwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $qos] } {
+		set command "$command qoslevel=$qos"
+	}
+
+	set my_pid [eval spawn $sacctmgr -i add cluster $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Adding Cluster" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	
+	return $exit_code
+}
+
+#
+# Use sacctmgr to remove the test cluster
+#
+proc remove_cluster {name} {
+        global access_err sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+	set nothing 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to remove\n"
+		return 1
+	}
+
+	set my_pid [eval spawn $sacctmgr -i delete cluster $name]
+	expect {
+		-re "privilege to perform this action" {
+			set access_err 1
+			exp_continue
+		}
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Deleting clusters" {
+			incr matches
+			exp_continue
+		}
+		-re " Nothing deleted" {
+			incr matches
+			set nothing 1
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr delete not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+	if {$access_err != 0} {
+		return 1
+	}
+	if {$matches != 1} {
+		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
+		incr exit_code 1
+	}
+	if { !$nothing } {
+		if { ![check_acct_associations] } {
+			send_user "\nFAILURE:  Our associations don't line up\n"
+			incr exit_code 1
+		}
+	}
+
+	return $exit_code
+}
+
+#
+# Use sacctmgr to add an account
+#
+#
+# Use sacctmgr to add an user
+#
+proc add_acct { cluster parent name desc org qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to add\n"
+		return 1
+	}
+
+	set command "name=$name"
+
+	if { [string length $cluster] } {
+		set command "$command cluster=$cluster"
+	}
+
+	if { [string length $desc] } {
+		set command "$command description=$desc"
+	}
+
+	if { [string length $fairshare] } {
+		set command "$command fairshare=$fairshare"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpumin] } {
+		set command "$command GrpCPUMins=$grpcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpu] } {
+		set command "$command GrpCPUs=$grpcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpjob] } {
+		set command "$command GrpJobs=$grpjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpnode] } {
+		set command "$command GrpNodes=$grpnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpsubmit] } {
+		set command "$command GrpSubmitJobs=$grpsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpwall] } {
+		set command "$command GrpWall=$grpwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpumin] } {
+		set command "$command MaxCPUMins=$maxcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpu] } {
+		set command "$command MaxCPUs=$maxcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxjob] } {
+		set command "$command MaxJobs=$maxjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxnode] } {
+		set command "$command MaxNodes=$maxnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxsubmit] } {
+		set command "$command MaxSubmitJobs=$maxsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxwall] } {
+		set command "$command MaxWall=$maxwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $parent] } {
+		set command "$command parent=$parent"
+	}
+
+	if { [string length $org] } {
+		set command "$command organization=$org"
+	}
+
+	if { [string length $qos] } {
+		set command "$command qoslevel=$qos"
+		set assoc_stuff 1
+	}
+
+	set my_pid [eval spawn $sacctmgr -i add account $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Adding Account" {
+			incr matches
+			exp_continue
+		}
+		-re "Associations" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 2} {
+		send_user "\nFAILURE:  sacctmgr had a problem adding account.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	return $exit_code
+}
+
+#
+# Use sacctmgr to remove an account
+#
+proc remove_acct { cluster name } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+	set nothing 1
+	set check "Deleting account"
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to remove\n"
+		return 1
+	}
+
+	set command "name=$name"
+
+	if { [string length $cluster] } {
+		set command "$command cluster=$cluster"
+		set check "Deleting account associations"
+	}
+
+	set my_pid [eval spawn $sacctmgr -i delete account $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "$check" {
+			incr matches
+			exp_continue
+		}
+		-re " Nothing deleted" {
+			incr matches
+			set nothing 1
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { !$nothing } {
+		if { ![check_acct_associations] } {
+			send_user "\nFAILURE:  Our associations don't line up\n"
+			incr exit_code 1
+		}
+	}
+
+	return $exit_code
+}
+#
+# Use sacctmgr to modify an account
+#
+proc mod_acct { cluster wparent name wdesc worg qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall parent desc org } {
+	global sacctmgr timeout
+	
+	set exit_code 0
+	set matches 0
+	set expected 0
+	set acct_stuff 0
+	set assoc_stuff 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to modify\n"
+		return 1
+	}
+
+	#set up the where
+	set wcommand "where name=$name"
+
+	if { [string length $cluster] } {
+		set wcommand "$wcommand cluster=$cluster"
+	}
+
+	if { [string length $wdesc] } {
+		set wcommand "$wcommand description='$wdesc'"
+	}
+
+	if { [string length $worg] } {
+		set wcommand "$wcommand organization='$worg'"
+	}
+
+	if { [string length $wparent] } {
+		set wcommand "$wcommand parent='$wparent'"
+	}
+
+	#set up the set
+	set scommand "set"
+	if { [string length $parent] } {
+		set scommand "$scommand parent=$parent"
+		set assoc_stuff 1
+	}
+
+	if { [string length $desc] } {
+		set scommand "$scommand description='$desc'"
+		set acct_stuff 1
+	}
+
+	if { [string length $org] } {
+		set scommand "$scommand organization='$org'"
+		set acct_stuff 1
+	}
+
+	if { [string length $fairshare] } {
+		set scommand "$scommand fairshare=$fairshare"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpumin] } {
+		set scommand "$scommand GrpCPUMins=$grpcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpu] } {
+		set scommand "$scommand GrpCPUs=$grpcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpjob] } {
+		set scommand "$scommand GrpJobs=$grpjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpnode] } {
+		set scommand "$scommand GrpNodes=$grpnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpsubmit] } {
+		set scommand "$scommand GrpSubmitJobs=$grpsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpwall] } {
+		set scommand "$scommand GrpWall=$grpwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpumin] } {
+		set scommand "$scommand MaxCPUMins=$maxcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpu] } {
+		set scommand "$scommand MaxCPUs=$maxcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxjob] } {
+		set scommand "$scommand MaxJobs=$maxjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxnode] } {
+		set scommand "$scommand MaxNodes=$maxnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxsubmit] } {
+		set scommand "$scommand MaxSubmitJobs=$maxsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxwall] } {
+		set scommand "$scommand MaxWall=$maxwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $qos] } {
+		set scommand "$scommand qoslevel=$qos"
+		set assoc_stuff 1
+	}
+
+	incr expected $acct_stuff
+	incr expected $assoc_stuff
+
+	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Modified accounts" {
+			incr matches
+			exp_continue
+		}
+		-re "Modified account associations" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != $expected} {
+		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
+	got $matches needed $expected\n"
+		incr exit_code 1
+	}
+	
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	return $exit_code
+}
+
+#
+# Use sacctmgr to add an user
+#
+proc add_user { cluster account name part admin dacct dwckey wckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to add\n"
+		return 1
+	}
+
+	set command "user=$name"
+
+	if { [string length $account] } {
+		set command "$command account=$account"
+	}
+
+	if { [string length $admin] } {
+		set command "$command adminlevel=$admin"
+	}
+
+	if { [string length $cluster] } {
+		set command "$command cluster=$cluster"
+	}
+
+	if { [string length $dacct] } {
+		set command "$command defaultaccount=$dacct"
+	}
+
+	if { [string length $dwckey] } {
+		set command "$command defaultwckey=$dwckey"
+	}
+
+	if { [string length $fairshare] } {
+		set command "$command fairshare=$fairshare"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpumin] } {
+		set command "$command GrpCPUMins=$grpcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpu] } {
+		set command "$command GrpCPUs=$grpcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpjob] } {
+		set command "$command GrpJobs=$grpjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpnode] } {
+		set command "$command GrpNodes=$grpnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpsubmit] } {
+		set command "$command GrpSubmitJobs=$grpsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpwall] } {
+		set command "$command GrpWall=$grpwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpumin] } {
+		set command "$command MaxCPUMins=$maxcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpu] } {
+		set command "$command MaxCPUs=$maxcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxjob] } {
+		set command "$command MaxJobs=$maxjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxnode] } {
+		set command "$command MaxNodes=$maxnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxsubmit] } {
+		set command "$command MaxSubmitJobs=$maxsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxwall] } {
+		set command "$command MaxWall=$maxwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $part] } {
+		set command "$command partition=$part"
+	}
+
+	if { [string length $qos] } {
+		set command "$command qoslevel=$qos"
+	}
+
+	if { [string length $wckey] } {
+		set command "$command wckeys=$wckey"
+	}
+
+	set my_pid [eval spawn $sacctmgr -i add user $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Adding User" {
+			incr matches
+			exp_continue
+		}
+		-re "Associations" {
+			incr matches
+			exp_continue
+		}
+		-re "WCKeys" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 2 && $matches != 3} {
+		send_user "\nFAILURE:  sacctmgr had a problem adding user.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	return $exit_code
+}
+
+#
+# Use sacctmgr to remove an user
+#
+proc remove_user { cluster acct user } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+	set nothing 1
+	set check "Deleting user"
+
+	if { ![string length $user] } {
+		send_user "FAILURE: we need a name to remove\n"
+		return 1
+	}
+
+	set command "$user"
+
+	if { [string length $cluster] } {
+		set command "$command cluster=$cluster"
+		set check "Deleting user associations"
+	}
+
+	if { [string length $acct] } {
+		set command "$command account=$acct"
+		set check "Deleting user associations"
+	}
+
+	set my_pid [eval spawn $sacctmgr -i delete user $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknown problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "$check" {
+			incr matches
+			exp_continue
+		}
+		-re " Nothing deleted" {
+			incr matches
+			set nothing 1
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr delete not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { !$nothing } {
+		if { ![check_acct_associations] } {
+			send_user "\nFAILURE:  Our associations don't line up\n"
+			incr exit_code 1
+		}
+	}
+
+	return $exit_code
+}
+
+#
+# Use sacctmgr to modify an user
+#
+proc mod_user { cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey } {
+	global sacctmgr timeout
+	
+	set exit_code 0
+	set matches 0
+	set expected 0
+	set acct_stuff 0
+	set assoc_stuff 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to modify\n"
+		return 1
+	}
+
+	#set up the where
+	set wcommand "where name=$name"
+
+	if { [string length $cluster] } {
+		set wcommand "$wcommand cluster=$cluster"
+	}
+
+	if { [string length $account] } {
+		set wcommand "$wcommand account='$account'"
+	}
+
+	if { [string length $part] } {
+		set wcommand "$wcommand partition=$part"
+	}
+
+	if { [string length $wadmin] } {
+		set wcommand "$wcommand adminlevel=$wadmin"
+	}
+
+	if { [string length $wdacct] } {
+		set wcommand "$wcommand defaultaccount='$wdacct'"
+	}
+
+	if { [string length $wdwckey] } {
+		set wcommand "$wcommand defaultwckey=$wwckey"
+	}
+
+	#set up the set
+	set scommand "set"
+
+	if { [string length $admin] } {
+		set scommand "$scommand adminlevel=$admin"
+		set acct_stuff 1
+	}
+
+	if { [string length $dacct] } {
+		set scommand "$scommand defaultaccount='$dacct'"
+		set acct_stuff 1
+	}
+
+	if { [string length $dwckey] } {
+		set scommand "$scommand defaultwckey=$dwckey"
+		set acct_stuff 1
+	}
+
+	if { [string length $fairshare] } {
+		set scommand "$scommand fairshare=$fairshare"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpumin] } {
+		set scommand "$scommand GrpCPUMins=$grpcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpcpu] } {
+		set scommand "$scommand GrpCPUs=$grpcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpjob] } {
+		set scommand "$scommand GrpJobs=$grpjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpnode] } {
+		set scommand "$scommand GrpNodes=$grpnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpsubmit] } {
+		set scommand "$scommand GrpSubmitJobs=$grpsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $grpwall] } {
+		set scommand "$scommand GrpWall=$grpwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpumin] } {
+		set scommand "$scommand MaxCPUMins=$maxcpumin"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxcpu] } {
+		set scommand "$scommand MaxCPUs=$maxcpu"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxjob] } {
+		set scommand "$scommand MaxJobs=$maxjob"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxnode] } {
+		set scommand "$scommand MaxNodes=$maxnode"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxsubmit] } {
+		set scommand "$scommand MaxSubmitJobs=$maxsubmit"
+		set assoc_stuff 1
+	}
+
+	if { [string length $maxwall] } {
+		set scommand "$scommand MaxWall=$maxwall"
+		set assoc_stuff 1
+	}
+
+	if { [string length $qos] } {
+		set scommand "$scommand qoslevel$qos"
+		set assoc_stuff 1
+	}
+
+	incr expected $acct_stuff
+	incr expected $assoc_stuff
+
+	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknown problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Modified account associations" {
+			incr matches
+			exp_continue
+		}
+		-re "Modified users" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr modify not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != $expected} {
+		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
+	got $matches needed $expected\n"
+		incr exit_code 1
+	}
+	
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	return $exit_code
+}
+
+#
+# Use sacctmgr to create a QoS
+#	
+proc add_qos {name} {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: Need name of qos to add\n"
+		return 1
+	}
+
+	set my_pid [eval spawn $sacctmgr -i add qos $name]
+	expect {
+		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting qos's from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknown problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Adding QOS" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem adding QoS got $matches\n"
+		incr exit_code 1
+	}
+
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	
+	return $exit_code
+}
+
+#
+# Use sacctmgr to remove the test QoS
+#
+proc remove_qos {name} {
+        global access_err sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+	set nothing 0
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to remove\n"
+		return 1
+	}
+
+	set my_pid [eval spawn $sacctmgr -i delete qos $name]
+	expect {
+		-re "privilege to perform this action" {
+			set access_err 1
+			exp_continue
+		}
+		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknown problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Deleting QOS" {
+			incr matches
+			exp_continue
+		}
+		-re " Nothing deleted" {
+			incr matches
+			set nothing 1
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr delete not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+	if {$access_err != 0} {
+		return 1
+	}
+	if {$matches != 1} {
+		send_user "\nFAILURE: sacctmgr had a problem deleting QoS got $matches\n"
+		incr exit_code 1
+	}
+	if { !$nothing } {
+		if { ![check_acct_associations] } {
+			send_user "\nFAILURE:  Our associations don't line up\n"
+			incr exit_code 1
+		}
+	}
+
+	return $exit_code
+}
+
+#
+# Use sacctmgr to add a coordinator
+#
+proc add_coor { accounts names } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+
+	if { ![string length $names] } {
+		send_user "FAILURE: we need a name to add\n"
+		return 1
+	}
+
+	set command "$names"
+
+	if { [string length $accounts] } {
+		set command "$command account=$accounts"
+	}
+
+#	if { [string length $names] } {
+#		set command "$command names=$names"
+#	}
+
+	set my_pid [eval spawn $sacctmgr -i add coordinator $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknwon problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "Adding Coordinator" {
+			incr matches
+			exp_continue
+		}
+		-re "Associations" {
+			incr matches
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr add not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem adding coordinator.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { ![check_acct_associations] } {
+		send_user "\nFAILURE:  Our associations don't line up\n"
+		incr exit_code 1
+	}
+	return $exit_code
+}
+
+#
+# Use sacctmgr to remove a coordinator
+#
+proc remove_coor { accounts names } {
+        global sacctmgr timeout
+
+	set exit_code 0
+	set matches 0
+	set nothing 1
+	set check "Deleting user"
+
+	if { ![string length $name] } {
+		send_user "FAILURE: we need a name to remove\n"
+		return 1
+	}
+
+	set command "$name"
+
+	if { [string length $accounts] } {
+		set command "$command accounts=$accounts"
+		set check "Deleting coordinator associations"
+	}
+
+	if { [string length $names] } {
+		set command "$command names=$names"
+		set check "Deleting coordinator associations"
+	}
+
+	set my_pid [eval spawn $sacctmgr -i delete coordinator $command]
+	expect {
+		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
+			send_user "FAILURE: there was a problem with the sacctmgr command\n"
+			incr exit_code 1
+		}
+		-re "Problem getting" {
+			send_user "FAILURE: there was a problem getting information from the database\n"
+			incr exit_code 1
+		}
+		-re "Problem adding" {
+			send_user "FAILURE: there was an unknown problem\n"
+			incr exit_code 1
+		}
+		-re "No associations" {
+			send_user "FAILURE: your command didn't return anything\n"
+			incr exit_code 1
+		}
+		-re "$check" {
+			incr matches
+			exp_continue
+		}
+		-re " Nothing deleted" {
+			incr matches
+			set nothing 1
+			exp_continue
+		}
+		timeout {
+			send_user "\nFAILURE: sacctmgr delete not responding\n"
+			slow_kill $my_pid
+			incr exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+
+	if {$matches != 1} {
+		send_user "\nFAILURE:  sacctmgr had a problem deleting coordinator.
+	got $matches\n"
+		incr exit_code 1
+	}
+
+	if { !$nothing } {
+		if { ![check_acct_associations] } {
+			send_user "\nFAILURE:  Our associations don't line up\n"
+			incr exit_code 1
+		}
+	}
+
+	return $exit_code
+}
+
diff --git a/testsuite/expect/test21.13 b/testsuite/expect/test21.13
index ced7aeb71426874a3dc76fab5152a92df4ab25e3..4a69b71d083458b99f91beae9a155ce9fb86ab91 100755
--- a/testsuite/expect/test21.13
+++ b/testsuite/expect/test21.13
@@ -29,7 +29,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.13"
 set exit_code   0
@@ -82,438 +82,35 @@ if { [test_account_storage] == 0 } {
 	exit 0
 }
 
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to preform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_cluster "$tc1,$tc2"
+remove_cluster "$tc1,$tc2"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
-_remove_acct "" "$nm1,$nm2,$nm3"
+remove_acct "" "$nm1,$nm2,$nm3"
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2"]
+incr exit_code [add_cluster "$tc1,$tc2" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
 # OK This is the real test, first test change the desc and org of the accounts 
-incr exit_code [_mod_acct "" "$nm1,$nm2,$nm3" $ds2 $or2 "" "" "" "" "" "" "" ""]
+incr exit_code [mod_acct "" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" $ds2 $or2]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -546,10 +143,10 @@ if {$matches != 3} {
 }
 
 # Next, test change the limits of the accounts 
-incr exit_code [_mod_acct "" "$nm1" "" "" "" $fs2 $mc2 $mj2 $mn2 $mw2 "" ""]
+incr exit_code [mod_acct "" "" "$nm1" "" "" "" $fs2 "" "" "" "" "" "" $mc2 "" $mj2 $mn2 "" $mw2 "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -583,10 +180,10 @@ if {$matches != 6} {
 }
 
 # Next, test change the desc and limits of the accounts 
-incr exit_code [_mod_acct "" "$nm1" $ds1 $or1 "" -1 -1 -1 -1 -1 "" ""]
+incr exit_code [mod_acct "" "" "$nm1" "" "" "" -1 "" "" "" "" "" "" -1 "" -1 -1 "" -1 "" $ds1 $or1]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -623,9 +220,9 @@ if {$matches != 6} {
 
 # This is the end below here
 
-incr exit_code [_remove_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2"]
+incr exit_code [remove_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.14 b/testsuite/expect/test21.14
index f177eeb9a3de0d55ae1f1ada3f21f27b39488788..6c8d7f4567c9ad5695a55294e5fc24cec27ac3b2 100755
--- a/testsuite/expect/test21.14
+++ b/testsuite/expect/test21.14
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.14"
 set exit_code   0
@@ -80,439 +80,35 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to preform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_cluster "$tc1,$tc2"
+remove_cluster "$tc1,$tc2"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
-_remove_acct "" "$nm1,$nm2,$nm3"
+remove_acct "" "$nm1,$nm2,$nm3"
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2"]
+incr exit_code [add_cluster "$tc1,$tc2" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
 # OK This is the real test, first test change the desc and org of the accounts 
-incr exit_code [_mod_acct "" "$nm1,$nm2,$nm3" $ds2 $or2 "" "" "" "" "" "" "" ""]
+incr exit_code [mod_acct "" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" $ds2 $or2]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -545,10 +141,10 @@ if {$matches != 3} {
 }
 
 # Next, test change the limits of the accounts 
-incr exit_code [_mod_acct "" "$nm1,$nm2,$nm3" "" "" "" $fs2 $mc2 $mj2 $mn2 $mw2 "" ""]
+incr exit_code [mod_acct "" "" "$nm1,$nm2,$nm3" "" "" "" $fs2 "" "" "" "" "" "" $mc2 "" $mj2 $mn2 "" $mw2 "" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -581,10 +177,10 @@ if {$matches != 6} {
 }
 
 # Next, test change the desc and limits of the accounts 
-incr exit_code [_mod_acct "" "$nm1,$nm3" $ds1 $or1 "" -1 -1 -1 -1 -1 "" ""]
+incr exit_code [mod_acct "" "" "$nm1,$nm3" "" "" "" -1 "" "" "" "" "" "" -1 "" -1 -1 "" -1 "" $ds1 $or1]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -620,10 +216,10 @@ if {$matches != 6} {
 }
 
 # Next, test change the parent of $n3 to be $n2 on $tc1 sibling to be a child
-incr exit_code [_mod_acct "$tc1" "$nm3" "" "" "$nm2" "" "" "" "" "" "" ""]
+incr exit_code [mod_acct "$tc1" "" "$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "$nm2" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -661,10 +257,10 @@ if {$matches != 2} {
 
 # Next, test change the parent of $n2 to be $n3 on $tc1 
 # making the child the parent
-incr exit_code [_mod_acct "$tc1" "$nm2" "" "" "$nm3" "" "" "" "" "" "" ""]
+incr exit_code [mod_acct "$tc1" "" "$nm2" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "$nm3" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -699,10 +295,10 @@ if {$matches != 4} {
 
 # Next, test change the parent of $n3 to be $n2 on $tc1 again 
 # only this time the parent will become the child instead of it being a sibling.
-incr exit_code [_mod_acct "$tc1" "$nm3" "" "" "$nm2" "" "" "" "" "" "" ""]
+incr exit_code [mod_acct "$tc1" "" "$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "$nm2" "" ""]
 if { $exit_code } {
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2"
 	exit $exit_code
 }
 
@@ -735,16 +331,11 @@ if {$matches != 4} {
 }
 
 
-
-
-
-
-
 # This is the end below here
 
-incr exit_code [_remove_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2"]
+incr exit_code [remove_acct "$tc1,$tc2" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.15 b/testsuite/expect/test21.15
index 240edce7c55718a25361f9351b6408001d3b968d..559fdcdfe7c8315ee418f7091e0a284149081b22 100755
--- a/testsuite/expect/test21.15
+++ b/testsuite/expect/test21.15
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.15"
 set exit_code   0
@@ -107,630 +107,40 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { account adminlevel cluster defaultaccount fs maxcpu maxjob maxnodes maxwall name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $adminlevel] } {
-		set command "$command adminlevel=$adminlevel"
-	}
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $defaultaccount] } {
-		set command "$command defaultaccount=$defaultaccount"
-	}
-
-	if { [string length $fs] } {
-		set command "$command fairshare=$fs"
-	}
-
-	if { [string length $maxcpu] } {
-		set command "$command maxcpum=$maxcpu"
-	}
-
-	if { [string length $maxjob] } {
-		set command "$command maxjob=$maxjob"
-	}
-
-	if { [string length  $maxnodes] } {
-		set command "$command  maxnodes=$maxnodes"
-	}
-
-	if { [string length maxwall$] } {
-		set command "$command maxwall=$maxwall"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { cluster acct user } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $user] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$user"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting user associations"
-	}
-
-	if { [string length $acct] } {
-		set command "$command account=$acct"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
 # account adminlevel cluster defaultaccount fs maxcpu maxjob maxnodes maxwall name
-incr exit_code [_add_user "$nm1,$nm2,$nm3" "$alo" "$tc1,$tc2,$tc3" "$nm2" "$fs1" "$mc1" "$mj1" "$mn1" "$mw1" $us1]
+incr exit_code [add_user "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1" "" "$alo" "$nm2" "" "" "" "$fs1" "" "" "" "" "" "" "$mc1" "" "$mj1" "$mn1" "" "$mw1" ]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -765,11 +175,11 @@ if {$matches != 9} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "$tc1" "" "$us1,$us2,$us3"]
-incr exit_code [_remove_user "" "$nm1,$nm2,$nm3" "$us1,$us2,$us3"]
-incr exit_code [_remove_user "" "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "$tc1" "" "$us1,$us2,$us3"]
+incr exit_code [remove_user "" "$nm1,$nm2,$nm3" "$us1,$us2,$us3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.16 b/testsuite/expect/test21.16
index b534fa6be8ad6c95a71c3fff03dba1a1cad0c3e7..162aa914adef1a0f237429a052c7b5f58130df2c 100755
--- a/testsuite/expect/test21.16
+++ b/testsuite/expect/test21.16
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.16"
 set exit_code   0
@@ -107,625 +107,40 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { account adminlevel cluster defaultaccount fs maxcpu maxjob maxnodes maxwall name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $adminlevel] } {
-		set command "$command adminlevel=$adminlevel"
-	}
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $defaultaccount] } {
-		set command "$command defaultaccount=$defaultaccount"
-	}
-
-	if { [string length $fs] } {
-		set command "$command fairshare=$fs"
-	}
-
-	if { [string length $maxcpu] } {
-		set command "$command maxcpum=$maxcpu"
-	}
-
-	if { [string length $maxjob] } {
-		set command "$command maxjob=$maxjob"
-	}
-
-	if { [string length  $maxnodes] } {
-		set command "$command  maxnodes=$maxnodes"
-	}
-
-	if { [string length $maxwall] } {
-		set command "$command maxwall=$maxwall"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { acct user } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $user] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$user"
-
-	if { [string length $acct] } {
-		set command "$command account=$acct"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
 # account adminlevel cluster defaultaccount fs maxcpu maxjob maxnodes maxwall name
-incr exit_code [_add_user "$nm1,$nm2,$nm3" "$alo" "$tc1,$tc2,$tc3" "$nm2" "$fs1" "$mc1" "$mj1" "$mn1" "$mw1" $us1,$us2,$us3]
+incr exit_code [add_user "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" $us1,$us2,$us3 "" "$alo" "$nm2" "" "" "" "$fs1" "" "" "" "" "" "" "$mc1" "" "$mj1" "$mn1" "" "$mw1" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -760,9 +175,9 @@ if {$matches != 27} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.17 b/testsuite/expect/test21.17
index 493920d4d02ffd737d7b5e325d10ef50305106ab..400b82d2fb30ae5d41bcf03e9e1e3100bc07d55c 100755
--- a/testsuite/expect/test21.17
+++ b/testsuite/expect/test21.17
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.17"
 set exit_code   0
@@ -107,729 +107,50 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxc=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { cluster account name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { user name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $user] } {
-		set command "$command user=$user"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an user
-#
-proc _mod_user { adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $wnames] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where"
-
-	if { [string length $wcluster] } {
-		set wcommand "$wcommand cluster=$wcluster"
-	}
-
-	if { [string length $wnames] } {
-		set wcommand "$wcommand names='$wnames'"
-	}
-
-	if { [string length $waccounts] } {
-		set wcommand "$wcommand account='$waccount'"
-	}
-
-	#set up the set
-	set scommand "set"
-
-	if { [string length $adminlevel] } {
-		set scommand "$scommand adminlevel=$adminlevel"
-		set acct_stuff 1
-	}
-
-	if { [string length $defaultaccount] } {
-		set scommand "$scommand defaultaccount='$defaultaccount'"
-		set acct_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified users" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr modify not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+     	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
-incr exit_code [_add_user  "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3"]
+incr exit_code [add_user "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 # First test change the AdminLevel and DefaultAccount of a user 
-# adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
-incr exit_code [_mod_user  $alo $nm2 "" "" "" "" "" "" "" "$us1"]
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey
+
+incr exit_code [mod_user "" "" $us1 "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" $alo $nm2 ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -863,13 +184,13 @@ if {$matches != 3} {
 }
 
 # Next, test change the limits of one user
-# adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey
  
-incr exit_code [_mod_user "" "" $fs2 $mc2 $mj2 $mn2 $mw2 "" "$tc1,$tc2,$tc3" "$us2"]
+incr exit_code [mod_user "$tc1,$tc2,$tc3" "" "$us2" "" "" "" "" "" $fs2 "" "" "" "" "" "" $mc2 "" $mj2 $mn2 "" $mw2 "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -904,9 +225,9 @@ if {$matches != 27} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.18 b/testsuite/expect/test21.18
index 23251721cbd5cf14177f0d43f05d813d739ff7a3..9f244444829a074a0d032d813112cb1250f36fdf 100755
--- a/testsuite/expect/test21.18
+++ b/testsuite/expect/test21.18
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.18"
 set exit_code   0
@@ -107,728 +107,49 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { cluster account name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { user name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $user] } {
-		set command "$command user=$user"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an user
-#
-proc _mod_user { adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $wnames] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where"
-
-	if { [string length $wcluster] } {
-		set wcommand "$wcommand cluster=$wcluster"
-	}
-
-	if { [string length $wnames] } {
-		set wcommand "$wcommand names='$wnames'"
-	}
-
-	if { [string length $waccounts] } {
-		set wcommand "$wcommand account='$waccount'"
-	}
-
-	#set up the set
-	set scommand "set"
-
-	if { [string length $adminlevel] } {
-		set scommand "$scommand adminlevel=$adminlevel"
-		set acct_stuff 1
-	}
-
-	if { [string length $defaultaccount] } {
-		set scommand "$scommand defaultaccount='$defaultaccount'"
-		set acct_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified users" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr modify not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
-incr exit_code [_add_user  "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3"]
+incr exit_code [add_user  "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 # First test change the AdminLevel and DefaultAccount of the accounts  
-# adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
-incr exit_code [_mod_user  $alo $nm2 "" "" "" "" "" "" "" "$us1,$us2,$us3"]
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey 
+incr exit_code [mod_user "" "" "$us1,$us2,$us3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" $alo $nm2 ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -862,12 +183,12 @@ if {$matches != 3} {
 }
 
 # Test change the AdminLevel and DefaultAccount of two accounts  
-# adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
-incr exit_code [_mod_user $ala $nm3 "" "" "" "" "" "" "" "$us1,$us3"]
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey
+incr exit_code [mod_user "" "" "$us1,$us3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" $ala $nm3 ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -901,13 +222,13 @@ if {$matches != 3} {
 }
 
 # Next, test change the limits of the users
-# adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey
  
-incr exit_code [_mod_user "" "" $fs2 $mc2 $mj2 $mn2 $mw2 "" "$tc1,$tc2" "$us1,$us2,$us3"]
+incr exit_code [mod_user "$tc1,$tc2" "" "$us1,$us2,$us3" "" "" "" "" "" $fs2 "" "" "" "" "" "" $mc2 "" $mj2 $mn2 "" $mw2 "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -943,11 +264,11 @@ if {$matches != 18} {
 # Next, test change the limits of two users 
 # adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames
 
-incr exit_code [_mod_user "" "" $fs3 $mc3 $mj3 $mn3 $mw3 "" "" "$us1,$us3"]
+incr exit_code [mod_user "" "" "$us1,$us3" "" "" "" "" "" $fs3 "" "" "" "" "" "" $mc3 "" $mj3 $mn3 "" $mw3 "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -984,9 +305,9 @@ if {$matches != 18} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.19 b/testsuite/expect/test21.19
index 38a05e4246f1a8dbd27cd43182203f0d65c4ea7b..42fa0bba6d82bbc2577b4d5a3c684fc5b9fd2fa9 100755
--- a/testsuite/expect/test21.19
+++ b/testsuite/expect/test21.19
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "21.19"
 set exit_code   0
@@ -107,888 +107,49 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { cluster account name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user {  cluster acct user  } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $user] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$user"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting user associations"
-	}
-
-	if { [string length $acct] } {
-		set command "$command acct=$acct"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an user
-#
-proc _mod_user { adminlevel defaultaccount fs maxcpu maxjob maxnodes maxwall waccounts wcluster wnames} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $wnames] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where"
-
-	if { [string length $wcluster] } {
-		set wcommand "$wcommand cluster=$wcluster"
-	}
-
-	if { [string length $wnames] } {
-		set wcommand "$wcommand names='$wnames'"
-	}
-
-	if { [string length $waccounts] } {
-		set wcommand "$wcommand account='$waccount'"
-	}
-
-	#set up the set
-	set scommand "set"
-
-	if { [string length $adminlevel] } {
-		set scommand "$scommand adminlevel=$adminlevel"
-		set acct_stuff 1
-	}
-
-	if { [string length $defaultaccount] } {
-		set scommand "$scommand defaultaccount='$defaultaccount'"
-		set acct_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxcpum=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified users" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr modify not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add a coordinator
-#
-proc _add_coor { accounts names } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $names] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$names"
-
-	if { [string length $accounts] } {
-		set command "$command account=$accounts"
-	}
-
-#	if { [string length $names] } {
-#		set command "$command names=$names"
-#	}
-
-	set my_pid [eval spawn $sacctmgr -i add coordinator $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Coordinator" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding coordinator.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove a coordinator
-#
-proc _remove_coor { accounts names } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $accounts] } {
-		set command "$command accounts=$accounts"
-		set check "Deleting coordinator associations"
-	}
-
-	if { [string length $names] } {
-		set command "$command names=$names"
-		set check "Deleting coordinator associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete coordinator $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting coordinator.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
-incr exit_code [_add_user  "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3"]
+incr exit_code [add_user  "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" "$us1,$us2,$us3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 # Add a coordinator 
 # accounts names
-incr exit_code [_add_coor  $nm1 $us1]
+incr exit_code [add_coor $nm1 $us1]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1022,11 +183,11 @@ if {$matches != 3} {
 }
 
 # Next, add coordinator to two users 
-incr exit_code [_add_coor "$nm1,$nm3" "$us2,$us3"]
+incr exit_code [add_coor "$nm1,$nm3" "$us2,$us3"]
 if { $exit_code } {
-	_remove_user "" "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1061,9 +222,9 @@ if {$matches != 3} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "" "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.20 b/testsuite/expect/test21.20
index 29586fe0ec0efea82126f65af0f979cfcf8099a4..bb7f8b7ec1553550b3817cb05fa61c23113014fc 100755
--- a/testsuite/expect/test21.20
+++ b/testsuite/expect/test21.20
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "test21.20"
 set exit_code   0
@@ -111,847 +111,55 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add cluster $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to create a QoS
-#	
-proc _add_qos {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: Need name of qos to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add qos $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting qos's from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding QOS" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding QoS got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test QoS
-#
-proc _remove_qos {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete qos $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting QOS" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting QoS got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxc=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { account adminlevel cluster defaultaccount qoslevel name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $account] } {
-		set command "$command account=$account"
-	}
-
-	if { [string length $adminlevel] } {
-		set command "$command adminlevel=$adminlevel"
-	}
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-	}
-
-	if { [string length $defaultaccount] } {
-		set command "$command defaultaccount=$defaultaccount"
-	}
-
-	if { [string length $qoslevel] } {
-		set command "$command qoslevel=$qoslevel"
-	}
-
-	if { [string length $name] } {
-		set command "$command name=$name"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 2} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { acct user } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $user] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$user"
-
-	if { [string length $acct] } {
-		set command "$command account=$acct"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an user
-#
-proc _mod_user { qoslevel waccounts wcluster wnames} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $wnames] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where"
-
-	if { [string length $wcluster] } {
-		set wcommand "$wcommand cluster=$wcluster"
-	}
-
-	if { [string length $wnames] } {
-		set wcommand "$wcommand names='$wnames'"
-	}
-
-	if { [string length $waccounts] } {
-		set wcommand "$wcommand account='$waccounts'"
-	}
-
-	#set up the set
-	set scommand "set"
-
-	if { [string length $qoslevel] } {
-		set scommand "$scommand qoslevel$qoslevel"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified users" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr modify not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "$us1,$us2,$us3"
-_remove_acct "" "$nm1,$nm2,$nm3"
-_remove_qos "$qs1,$qs2,$qs3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3"
+remove_acct "" "$nm1,$nm2,$nm3"
+remove_qos "$qs1,$qs2,$qs3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add cluster
-incr exit_code [_add_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [add_cluster "$tc1,$tc2,$tc3" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add qos
-incr exit_code [_add_qos "$qs1,$qs2,$qs3"]
+incr exit_code [add_qos "$qs1,$qs2,$qs3"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-incr exit_code [_add_acct "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3"]
+incr exit_code [add_acct "$tc1,$tc2,$tc3" "" "$nm1,$nm2,$nm3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
-# account adminlevel cluster defaultaccount qoslevel name
-# account adminlevel cluster defaultaccount fs maxcpu maxjob maxnodes maxwall name
-incr exit_code [_add_user "$nm1,$nm2,$nm3" "$alo" "$tc1,$tc2,$tc3" "$nm2" "$qs1,$qs2" $us1,$us2,$us3]
+# cluster account name part admin dacct dwckey wckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall
+
+incr exit_code [add_user "$tc1,$tc2,$tc3" "$nm1,$nm2,$nm3" $us1,$us2,$us3 "" "$alo" "$nm2" "" "" "$qs1,$qs2" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -986,14 +194,15 @@ if {$matches != 27} {
 
 #modify user1 QoS
 # account adminlevel cluster defaultaccount qoslevel name
-# qoslevel waccounts wcluster wnames
+# cluster account name part wadmin wdacct wdwckey qos fairshare grpcpumin grpcpu grpjob grpnode grpsubmit grpwall maxcpumin maxcpu maxjob maxnode maxsubmit maxwall admin dacct dwckey
+
 #
-incr exit_code [_mod_user "=$qs3" "$nm2" "$tc1,$tc2,$tc3" $us1]
+incr exit_code [mod_user "$tc1,$tc2,$tc3" "$nm2" $us1 "" "" "" "" "=$qs3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1034,12 +243,12 @@ if {$matches != 21} {
 # account adminlevel cluster defaultaccount qoslevel name
 # qoslevel waccounts wcluster wnames
 #
-incr exit_code [_mod_user "+=$qs3" "$nm2" "$tc1,$tc2,$tc3" $us2]
+incr exit_code [mod_user "$tc1,$tc2,$tc3" "$nm2" $us2 "" "" "" "" "+=$qs3" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1085,12 +294,12 @@ if {$matches != 15} {
 # account adminlevel cluster defaultaccount qoslevel name
 # qoslevel waccounts wcluster wnames
 #
-incr exit_code [_mod_user "-=$qs2" "$nm2" "$tc1,$tc2,$tc3" $us3]
+incr exit_code [mod_user "$tc1,$tc2,$tc3" "$nm2" $us3 "" "" "" "" "-=$qs2" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3"
-	_remove_acct "" "$nm1,$nm2,$nm3"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3"
+	remove_acct "" "$nm1,$nm2,$nm3"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1133,10 +342,10 @@ if {$matches != 9} {
 
 # This is the end below here
 
-incr exit_code [_remove_user "" "$us1,$us2,$us3"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3"]
-incr exit_code [_remove_qos "$qs1,$qs2,$qs3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3"]
+incr exit_code [remove_qos "$qs1,$qs2,$qs3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"
diff --git a/testsuite/expect/test21.24 b/testsuite/expect/test21.24
index f9e01d342abe00038be6261a1b83816fb80bec62..310d096d5fe5371a9009f32f15db14ea8f8569a8 100755
--- a/testsuite/expect/test21.24
+++ b/testsuite/expect/test21.24
@@ -30,7 +30,7 @@
 # with SLURM; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 ############################################################################
-source ./globals
+source ./globals_accounting
 
 set test_id     "test21.24"
 set file_in     "test$test_id.input"
@@ -227,1123 +227,92 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } {
 	exit 0
 }
 
-#
-# Use sacctmgr to create a cluster
-#	
-proc _add_cluster {name FS GM GC GJ GN GS GW MM MC MJ MN MS MW QS} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set clust_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	#set up the add
-	set acommand ""
-
-	if { [string length $name] } {
-		set acommand "$acommand name=$name"
-		set assoc_stuff 1
-	}
-
-	if { [string length $FS] } {
-		set acommand "$acommand fairshare=$FS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GM] } {
-		set acommand "$acommand GrpCPUMins=$GM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GC] } {
-		set acommand "$acommand GrpCPUs=$GC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GJ] } {
-		set acommand "$acommand GrpJobs=$GJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GN] } {
-		set acommand "$acommand GrpNodes=$GN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GS] } {
-		set acommand "$acommand GrpSubmitJobs=$GS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GW] } {
-		set acommand "$acommand GrpWall=$GW"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MM] } {
-		set acommand "$acommand MaxCPUMins=$MM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MC] } {
-		set acommand "$acommand MaxCPUs=$MC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MJ] } {
-		set acommand "$acommand MaxJobs=$MJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MN] } {
-		set acommand "$acommand MaxNodes=$MN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MS] } {
-		set acommand "$acommand MaxSubmitJobs=$MS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MW] } {
-		set acommand "$acommand MaxWall=$MW"
-		set assoc_stuff 1
-	}
-
-	if { [string length $QS] } {
-		set acommand "$acommand qos=$QS"
-		set assoc_stuff 1
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add cluster $acommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Cluster" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding clusters
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test cluster
-#
-proc _remove_cluster {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete cluster $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting clusters" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to create a QoS
-#	
-proc _add_qos {name} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: Need name of qos to add\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i add qos $name]
-	expect {
-		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting qos's from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding QOS" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem adding QoS got $matches\n"
-		incr exit_code 1
-	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove the test QoS
-#
-proc _remove_qos {name} {
-        global access_err sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set my_pid [spawn $sacctmgr -i delete qos $name]
-	expect {
-		-re "privilege to perform this action" {
-			set access_err 1
-			exp_continue
-		}
-		-re "(There was a problem|Unknown condition|Unknown field|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Deleting QOS" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-	if {$access_err != 0} {
-		return 1
-	}
-	if {$matches != 1} {
-		send_user "\nFAILURE: sacctmgr had a problem deleting QoS got $matches\n"
-		incr exit_code 1
-	}
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to add an account
-#
-proc _add_acct { name FS GM GC GJ GN GS GW MM MC MJ MN MS MW QS PA CL DS OR} {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $FS] } {
-		set command "$command fairshare=$FS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GM] } {
-		set command "$command GrpCPUMins=$GM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GC] } {
-		set command "$command GrpCPUs=$GC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GJ] } {
-		set command "$command GrpJobs=$GJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GN] } {
-		set command "$command GrpNodes=$GN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GS] } {
-		set command "$command GrpSubmitJobs=$GS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GW] } {
-		set command "$command GrpWall=$GW"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MM] } {
-		set command "$command MaxCPUMins=$MM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MC] } {
-		set command "$command MaxCPUs=$MC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MJ] } {
-		set command "$command MaxJobs=$MJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MN] } {
-		set command "$command MaxNodes=$MN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MS] } {
-		set command "$command MaxSubmitJobs=$MS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MW] } {
-		set command "$command MaxWall=$MW"
-		set assoc_stuff 1
-	}
-
-	if { [string length $QS] } {
-		set command "$command qos=$QS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $PA] } {
-		set command "$command Parent=$PA"
-		set assoc_stuff 1
-	}
-
-	if { [string length $CL] } {
-		set command "$command Cluster=$CL"
-		set assoc_stuff 1
-	}
-
-	if { [string length $DS] } {
-		set command "$command Description=$DS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $OR] } {
-		set command "$command Organization=$OR"
-		set assoc_stuff 1
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding Account" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-#	if {$matches != 1} {
-#		send_user "\nFAILURE:  sacctmgr had a problem adding account.
-#	got $matches\n"
-#		incr exit_code 1
-#	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an account
-#
-proc _remove_acct { cluster name } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting account"
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$name"
-
-	if { [string length $cluster] } {
-		set command "$command cluster=$cluster"
-		set check "Deleting account associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete account $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting account.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an account
-#
-proc _mod_acct { cluster name desc org parent fs maxcpu maxjob maxnodes maxwall wdesc worg} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where $name"
-
-	if { [string length $cluster] } {
-		set wcommand "$wcommand cluster=$cluster"
-	}
-
-	if { [string length $wdesc] } {
-		set wcommand "$wcommand description='$wdesc'"
-	}
-
-	if { [string length $worg] } {
-		set wcommand "$wcommand organization='$worg'"
-	}
-
-	#set up the set
-	set scommand "set"
-	if { [string length $parent] } {
-		set scommand "$scommand parent=$parent"
-		set assoc_stuff 1
-	}
-
-	if { [string length $fs] } {
-		set scommand "$scommand fairshare=$fs"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxcpu] } {
-		set scommand "$scommand maxc=$maxcpu"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxjob] } {
-		set scommand "$scommand maxj=$maxjob"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxnodes] } {
-		set scommand "$scommand maxn=$maxnodes"
-		set assoc_stuff 1
-	}
-
-	if { [string length $maxwall] } {
-		set scommand "$scommand maxw=$maxwall"
-		set assoc_stuff 1
-	}
-
-	if { [string length $desc] } {
-		set scommand "$scommand description='$desc'"
-		set acct_stuff 1
-	}
-
-	if { [string length $org] } {
-		set scommand "$scommand organization='$org'"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify account $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified accounts" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying account.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-
-#
-# Use sacctmgr to add an user
-#
-proc _add_user { name AC AL CL DA DK WK QS FS GM GC GJ GN GS GW MM MC MJ MN MS MW } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-
-	if { ![string length $name] } {
-		send_user "FAILURE: we need a name to add\n"
-		return 1
-	}
-
-	set ucommand "$name"
-
-	if { [string length $AC] } {
-		set ucommand "$ucommand account=$AC"
-	}
-
-	if { [string length $AL] } {
-		set ucommand "$ucommand adminlevel=$AL"
-	}
-
-	if { [string length $CL] } {
-		set ucommand "$ucommand cluster=$CL"
-	}
-
-	if { [string length $DA] } {
-		set ucommand "$ucommand defaultaccount=$DA"
-	}
-
-	if { [string length $DK] } {
-		set ucommand "$ucommand defaultwckey=$DK"
-	}
-
-	if { [string length $WK] } {
-		set ucommand "$ucommand wckeys=$WK"
-	}
-
-	if { [string length $QS] } {
-		set ucommand "$ucommand qoslevel=$QS"
-	}
-
-	if { [string length $name] } {
-		set ucommand "$ucommand name=$name"
-	}
-
-	if { [string length $FS] } {
-		set ucommand "$ucommand fairshare=$FS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GM] } {
-		set ucommand "$ucommand GrpCPUMins=$GM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GC] } {
-		set ucommand "$ucommand GrpCPUs=$GC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GJ] } {
-		set ucommand "$ucommand GrpJobs=$GJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GN] } {
-		set ucommand "$ucommand GrpNodes=$GN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GS] } {
-		set ucommand "$ucommand GrpSubmitJobs=$GS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $GW] } {
-		set ucommand "$ucommand GrpWall=$GW"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MM] } {
-		set ucommand "$ucommand MaxCPUMins=$MM"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MC] } {
-		set ucommand "$ucommand MaxCPUs=$MC"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MJ] } {
-		set ucommand "$ucommand MaxJobs=$MJ"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MN] } {
-		set ucommand "$ucommand MaxNodes=$MN"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MS] } {
-		set ucommand "$ucommand MaxSubmitJobs=$MS"
-		set assoc_stuff 1
-	}
-
-	if { [string length $MW] } {
-		set ucommand "$ucommand MaxWall=$MW"
-		set assoc_stuff 1
-	}
-
-	set my_pid [eval spawn $sacctmgr -i add user $ucommand]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknwon problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Adding User" {
-			incr matches
-			exp_continue
-		}
-		-re "Associations" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr add not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-#	if {$matches != 2} {
-#		send_user "\nFAILURE:  sacctmgr had a problem adding user.
-#	got $matches\n"
-#		incr exit_code 1
-#	}
-
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
-#
-# Use sacctmgr to remove an user
-#
-proc _remove_user { acct user } {
-        global sacctmgr timeout
-
-	set exit_code 0
-	set matches 0
-	set nothing 1
-	set check "Deleting user"
-
-	if { ![string length $user] } {
-		send_user "FAILURE: we need a name to remove\n"
-		return 1
-	}
-
-	set command "$user"
-
-	if { [string length $acct] } {
-		set command "$command account=$acct"
-		set check "Deleting user associations"
-	}
-
-	set my_pid [eval spawn $sacctmgr -i delete user $command]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "$check" {
-			incr matches
-			exp_continue
-		}
-		-re " Nothing deleted" {
-			incr matches
-			set nothing 1
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr delete not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != 1} {
-		send_user "\nFAILURE:  sacctmgr had a problem deleting user.
-	got $matches\n"
-		incr exit_code 1
-	}
-
-	if { !$nothing } {
-		if { ![check_acct_associations] } {
-			send_user "\nFAILURE:  Our associations don't line up\n"
-			incr exit_code 1
-		}
-	}
-
-	return $exit_code
-}
-
-#
-# Use sacctmgr to modify an user
-#
-proc _mod_user { qoslevel waccounts wcluster wnames} {
-	global sacctmgr timeout
-	
-	set exit_code 0
-	set matches 0
-	set expected 0
-	set acct_stuff 0
-	set assoc_stuff 0
-
-	if { ![string length $wnames] } {
-		send_user "FAILURE: we need a name to modify\n"
-		return 1
-	}
-
-	#set up the where
-	set wcommand "where"
-
-	if { [string length $wcluster] } {
-		set wcommand "$wcommand cluster=$wcluster"
-	}
-
-	if { [string length $wnames] } {
-		set wcommand "$wcommand names='$wnames'"
-	}
-
-	if { [string length $waccounts] } {
-		set wcommand "$wcommand account='$waccounts'"
-	}
-
-	#set up the set
-	set scommand "set"
-
-	if { [string length $qoslevel] } {
-		set scommand "$scommand qoslevel$qoslevel"
-		set acct_stuff 1
-	}
-
-	incr expected $acct_stuff
-	incr expected $assoc_stuff
-
-	set my_pid [eval spawn $sacctmgr -i modify user $scommand $wcommand ]
-	expect {
-		-re "(There was a problem|Unknown condition|Bad format on|Bad MaxWall|Unknown option)" {
-			send_user "FAILURE: there was a problem with the sacctmgr command\n"
-			incr exit_code 1
-		}
-		-re "Problem getting" {
-			send_user "FAILURE: there was a problem getting information from the database\n"
-			incr exit_code 1
-		}
-		-re "Problem adding" {
-			send_user "FAILURE: there was an unknown problem\n"
-			incr exit_code 1
-		}
-		-re "No associations" {
-			send_user "FAILURE: your command didn't return anything\n"
-			incr exit_code 1
-		}
-		-re "Modified account associations" {
-			incr matches
-			exp_continue
-		}
-		-re "Modified users" {
-			incr matches
-			exp_continue
-		}
-		timeout {
-			send_user "\nFAILURE: sacctmgr modify not responding\n"
-			slow_kill $my_pid
-			incr exit_code 1
-		}
-		eof {
-			wait
-		}
-	}
-
-	if {$matches != $expected} {
-		send_user "\nFAILURE:  sacctmgr had a problem modifying user.
-	got $matches needed $expected\n"
-		incr exit_code 1
-	}
-	
-	if { ![check_acct_associations] } {
-		send_user "\nFAILURE:  Our associations don't line up\n"
-		incr exit_code 1
-	}
-	return $exit_code
-}
-
 #make sure we have a clean system and permission to do this work
-_remove_user "" "$us1,$us2,$us3,$us4"
-_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-_remove_qos "$qs1,$qs2,$qs3"
-_remove_cluster "$tc1,$tc2,$tc3"
+remove_user "" "" "$us1,$us2,$us3,$us4"
+remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+remove_qos "$qs1,$qs2,$qs3"
+remove_cluster "$tc1,$tc2,$tc3"
 if {$access_err != 0} {
 	send_user "\nWARNING: not authorized to perform this test\n"
 	exit $exit_code
 }
 
 #add qos
-incr exit_code [_add_qos "$qs2"]
+incr exit_code [add_qos "$qs2"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add cluster
-#name Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob QOS
-incr exit_code [_add_cluster "$tc3" "$fs6" "$gm6" "$gc6" "$gj6" "$gn6" "$gs6" "$gw6" "$mm6" "$mc6" "$mj6" "$mn6" "$ms6" "$mw6" "$qs2"]
+#name QOS Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob
+incr exit_code [add_cluster "$tc3" "$qs2" "$fs6" "$gm6" "$gc6" "$gj6" "$gn6" "$gs6" "$gw6" "$mm6" "$mc6" "$mj6" "$mn6" "$ms6" "$mw6"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add accounts
-#name Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob QOS parent Cluster DescriptionOrganization
-incr exit_code [_add_acct "$nm4" "$fs5" "$gm5" "$gc5" "$gj5" "$gn5" "$gs5" "$gw5" "$mm5" "$mc5" "$mj5" "$mn5" "$ms5" "$mw5" "$qs2" "$roo" "$cl3" "$ds4" "$or4" ]
+#cluster parent name description organization qos Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob
+incr exit_code [add_acct "$cl3" "$roo" "$nm4" "$ds4" "$or4" "$qs2" "$fs5" "$gm5" "$gc5" "$gj5" "$gn5" "$gs5" "$gw5" "$mm5" "$mc5" "$mj5" "$mn5" "$ms5" "$mw5"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
-incr exit_code [_add_acct "$nm3" "$fs4" "$gm4" "$gc4" "$gj4" "$gn4" "$gs4" "$gw4" "$mm4" "$mc4" "$mj4" "$mn4" "$ms4" "$mw4" "$qs2" "$nm4" "$cl3" "$ds3" "$or3" ]
+incr exit_code [add_acct "$cl3" "$nm4" "$nm3" "$ds3" "$or3" "$qs2" "$fs4" "$gm4" "$gc4" "$gj4" "$gn4" "$gs4" "$gw4" "$mm4" "$mc4" "$mj4" "$mn4" "$ms4" "$mw4"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
-incr exit_code [_add_acct "$nm2" "$fs3" "$gm3" "$gc3" "$gj3" "$gn3" "$gs3" "$gw3" "$mm3" "$mc3" "$mj3" "$mn3" "$ms3" "$mw3" "$qs2" "$nm3" "$cl3" "$ds2" "$or2" ]
+incr exit_code [add_acct "$cl3" "$nm3" "$nm2" "$ds2" "$or2" "$qs2" "$fs3" "$gm3" "$gc3" "$gj3" "$gn3" "$gs3" "$gw3" "$mm3" "$mc3" "$mj3" "$mn3" "$ms3" "$mw3"]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
 #add users
-# account adminlevel cluster defaultaccount qoslevel name Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob 
-incr exit_code [_add_user "$us3" "$nm4" "$ala" "$tc3" "$nm3" "$wk3" "$wk1,$wk2,$wk4" "$qs2" "$fs3" "$gm3" "$gc3" "$gj3" "$gn3" "$gs3" "$gw3" "$mm3" "$mc3" "$mj3" "$mn3" "$ms3" "$mw3" ]
+# cluster account name part adminlevel defaultaccount defaultwckey wckeys qoslevel Fairshare GrpCPUMins GrpCPUs GrpJobs GrpNodes GrpSubmitJobs GrpWall MaxCPUMins MaxCPUs MaxJobs MaxNodes MaxSubmitJobs MaxWallDurationPerJob 
+incr exit_code [add_user "$tc3" "$nm4" "$us3" "" "$ala" "$nm3" "$wk3" "$wk1,$wk2,$wk4" "$qs2" "$fs3" "$gm3" "$gc3" "$gj3" "$gn3" "$gs3" "$gw3" "$mm3" "$mc3" "$mj3" "$mn3" "$ms3" "$mw3" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
-incr exit_code [_add_user "$us2" "$nm3" "$alo" "$tc3" "$nm2" "$wk2" "$wk1,$wk3,$wk4" "$qs2" "$fs2" "$gm2" "$gc2" "$gj2" "$gn2" "$gs2" "$gw2" "$mm2" "$mc2" "$mj2" "$mn2" "$ms2" "$mw2" ]
+incr exit_code [add_user "$tc3" "$nm3" "$us2" "" "$alo" "$nm2" "$wk2" "$wk1,$wk3,$wk4" "$qs2" "$fs2" "$gm2" "$gc2" "$gj2" "$gn2" "$gs2" "$gw2" "$mm2" "$mc2" "$mj2" "$mn2" "$ms2" "$mw2" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
-incr exit_code [_add_user "$us1" "$nm2" "$aln" "$tc3" "$nm2" "$wk1" "$wk2,$wk3,$wk4" "$qs2" "$fs1" "$gm1" "$gc1" "$gj1" "$gn1" "$gs1" "$gw1" "$mm1" "$mc1" "$mj1" "$mn1" "$ms1" "$mw1" ]
+incr exit_code [add_user "$tc3" "$nm2" "$us1" "" "$aln" "$nm2" "$wk1" "$wk2,$wk3,$wk4" "$qs2" "$fs1" "$gm1" "$gc1" "$gj1" "$gn1" "$gs1" "$gw1" "$mm1" "$mc1" "$mj1" "$mn1" "$ms1" "$mw1" ]
 if { $exit_code } {
-	_remove_user "" "$us1,$us2,$us3,$us4"
-	_remove_acct "" "$nm1,$nm2,$nm3,$nm4"
-	_remove_qos "$qs1,$qs2,$qs3"
-	_remove_cluster "$tc1,$tc2,$tc3"
+	remove_user "" "" "$us1,$us2,$us3,$us4"
+	remove_acct "" "$nm1,$nm2,$nm3,$nm4"
+	remove_qos "$qs1,$qs2,$qs3"
+	remove_cluster "$tc1,$tc2,$tc3"
 	exit $exit_code
 }
 
@@ -1521,10 +490,10 @@ if {$matches != 14} {
 #
 # This is the end below here
 
-incr exit_code [_remove_user "" "$us1,$us2,$us3,$us4"]
-incr exit_code [_remove_acct "" "$nm1,$nm2,$nm3,$nm4"]
-incr exit_code [_remove_qos "$qs1,$qs2,$qs3"]
-incr exit_code [_remove_cluster "$tc1,$tc2,$tc3"]
+incr exit_code [remove_user "" "" "$us1,$us2,$us3,$us4"]
+incr exit_code [remove_acct "" "$nm1,$nm2,$nm3,$nm4"]
+incr exit_code [remove_qos "$qs1,$qs2,$qs3"]
+incr exit_code [remove_cluster "$tc1,$tc2,$tc3"]
 
 if {$exit_code == 0} {
 	send_user "\nSUCCESS\n"