diff --git a/deploy.module b/deploy.module
index f310dfb..b7ab33d 100644
--- a/deploy.module
+++ b/deploy.module
@@ -370,7 +370,7 @@ function deploy_plan_push_form_submit($form, &$form_state) {
     $form_state['redirect'] = "admin/build/deploy/deploy_check_batch";
   }
   else {
-    $dlid = variable_get('deploy_log_id', '');
+    $dlid = deploy_push_get_log_id();
     deploy_plan_cleanup();
     $form_state['redirect'] = "admin/build/deploy/logs/details/$dlid";
   }
@@ -381,7 +381,7 @@ function deploy_plan_push_form_submit($form, &$form_state) {
  */
 function deploy_check_batch() {
   $operations = array();
-  $pid = variable_get('deploy_pid', '');
+  $pid = deploy_push_get_pid(); 
   $items = deploy_get_plan_items($pid);
   
   watchdog('plan items', print_r($items, TRUE));
@@ -436,7 +436,8 @@ function deploy_plan_check_item_batch($module, $data, $description, &$context) {
  */
 function deploy_push_batch() {
   $operations = array();
-  $pid = variable_get('deploy_pid', '');
+  $pid = deploy_push_get_pid();
+
   $items = deploy_get_plan_items($pid);
 
   // The batch oeprations are calls to deploy_item_batch(), which is just a wrapper
@@ -457,7 +458,7 @@ function deploy_push_batch() {
   );
 
   // When complete, redirect to the log for this deployment.
-  $dlid = variable_get('deploy_log_id', '');
+  $dlid = deploy_push_get_log_id();
   batch_set($batch);
   batch_process("admin/build/deploy/logs/details/$dlid");
 }
@@ -612,7 +613,7 @@ function deploy_get_min_weight($pid) {
  */
 function deploy_send($protocol_args, $function_args) {
   // Get the active server.
-  $server = variable_get('deploy_server', array());
+  $server = deploy_push_get_current_server();
 
   array_unshift($protocol_args, $server['url']);
   deploy_auth_invoke($server['auth_type'], 'arguments callback', $protocol_args, $function_args);
@@ -700,18 +701,18 @@ function deploy_plan_init($pid, $sid, $settings = array()) {
 
   // Save this data out so the other modules can get it. Not sure of a better
   // way to handle this.
-  variable_set('deploy_server', $server);
-  variable_set('deploy_pid', $pid);
+  deploy_push_set_current_server($server);
+  deploy_push_set_pid($pid);
 
   // This used to be a static within deploy_item(), but batch API breaks
   // statics so I was forced down this route instead.
-  variable_set('deploy_fatal', FALSE);
+  deploy_push_set_fatal(FALSE,TRUE); // use the "init" op for deploy_push_set_fatal so that it overrides existings value
 
   // Rather than save foreign keys out to the server/plan/user in the log,
   // I'm saving actual identifying data. This keeps the log pure in case
   // associated data gets deleted.
   db_query("INSERT INTO {deploy_log} (plan, server, username, ts) VALUES ('%s', '%s', '%s', %d)", $plan['name'], $server['description'], $user->name, time());
-  variable_set('deploy_log_id', db_last_insert_id('deploy_log', 'dlid'));
+  deploy_push_set_log_id(db_last_insert_id('deploy_log', 'dlid'));
   
   // Allow other modules to do stuff before the content gets pushed.
   module_invoke_all('deploy_pre_plan', $pid);
@@ -781,7 +782,7 @@ function deploy_item($item) {
 
   // Static error flag so that we can use it between calls and not have to
   // handle errors in the batch process.
-  $deploy_fatal = variable_get('deploy_fatal', FALSE);
+  $deploy_fatal = deploy_push_get_fatal();
 
   // If nothing has previously errored out, then try and deploy the current item.
   // Otherwise, note in the log that this item was not deployed due to previous error.
@@ -792,7 +793,7 @@ function deploy_item($item) {
     // If it results in failure, log the error message and set the $deploy_fatal
     // flag. Otherise log success and move onto the next one.
     if ($xmlrpc_result === FALSE) {
-      variable_set('deploy_fatal', TRUE);
+      deploy_push_set_fatal(TRUE);
       $result = t('Error');
       $message = xmlrpc_error_msg();
     }
@@ -807,7 +808,7 @@ function deploy_item($item) {
   }
 
   // And log the results.
-  db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", variable_get('deploy_log_id', ''), $item['module'], $item['description'], $result, $message);
+  deploy_push_log_detail($item['module'],$item['description'],$result,$message);
 
 }
 
@@ -824,11 +825,19 @@ function deploy_plan_cleanup() {
   $server = variable_get('deploy_server', '');
   deploy_auth_invoke($server['auth_type'], 'cleanup callback');
 
+  // unset drupal variables used in deploy
   variable_del('deploy_server');
   variable_del('deploy_pid');
   variable_del('deploy_log_id');
   variable_del('deploy_fatal');
 
+  // unset all session variables
+  unset($_SESSION['deploy_pid']);
+  unset($_SESSION['deploy_current_server']);
+  // the following session vars are not yet used
+  unset($_SESSION['deploy_log_id']);
+  unset($_SESSION['deploy_fatal']);
+
   // Allow other modules to do post-deployment tasks.
   module_invoke_all('deploy_post_plan', $pid);
 }
@@ -1092,7 +1101,7 @@ function deploy_auth_sessid_init($server = array()) {
   // to the 'deploy_sessid' variable, which all other xmlrpc calls to the
   // remote server passes.
   $result = deploy_send(array('system.connect'), array());
-  variable_set('deploy_auth_sessid', $result['sessid']);
+  deploy_push_set_current_sessid($result['sessid']);
 
   // Then we can log in.
   $result = deploy_send(array('user.login'), array($server['settings']['username'], $server['settings']['password']));
@@ -1100,10 +1109,10 @@ function deploy_auth_sessid_init($server = array()) {
   // If it fails, then add a message to the log. Otherwise set the session ID into
   // a drupal variable for the other functions to grab.
   if ($result === FALSE) {
-    db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", variable_get('deploy_log_id', ''), 'login', 'Remote user login', 'Error', xmlrpc_error_msg());
+    deploy_push_log_detail('login','Remote user login','Error',xmlrpc_error_msg());
   }
   else {
-    variable_set('deploy_auth_sessid', $result['sessid']);
+    deploy_push_set_current_sessid($result['sessid']);
     return TRUE;
   }
 }
@@ -1113,7 +1122,7 @@ function deploy_auth_sessid_init($server = array()) {
  */
 function deploy_auth_key_arguments(&$protocol_args, &$function_args) {
   // Get the active server.
-  $server = variable_get('deploy_server', array());
+  $server = deploy_push_get_current_server();
 
   $timestamp = time();
   $method = $protocol_args[1];
@@ -1130,7 +1139,7 @@ function deploy_auth_key_arguments(&$protocol_args, &$function_args) {
 function deploy_auth_sessid_arguments(&$protocol_args, &$function_args) {
   // Check the method name. The server URL is the first argument.
   if ($protocol_args[1] != 'system.connect') {
-    $sessid = variable_get('deploy_auth_sessid', '');
+    $sessid = deploy_push_get_current_sessid();
     array_push($protocol_args, $sessid);
   }
 }
@@ -1208,3 +1217,191 @@ function deploy_plan_item_delete($conditions = array()) {
 
   db_query('DELETE FROM {deploy_plan_items} WHERE ' . $where, $conditions);
 }
+
+/**
+ * Get the PID of plan currently being deployed, or variable holding it (via ref)
+ * 
+ * @access public
+ * @return reference
+ *   Int value of PID, with ref to SESSION variable holding it 
+ */
+function &deploy_push_get_pid() {
+  static $deploy_pid;
+  if (isset($deploy_pid)) return $deploy_pid;
+  if (isset($_SESSION['deploy_pid']))
+    $deploy_pid = &$_SESSION['deploy_pid'];
+  else
+    $deploy_pid = variable_get('deploy_pid',NULL);
+  return $deploy_pid;
+}
+
+/**
+ * Set the PID of the plan currently being deployed.
+ *
+ * Note, uses the fact that get_pid returns a reference to get ref to the session var
+ * 
+ * @param mixed $pid 
+ * @access public
+ * @return void
+ */
+function deploy_push_set_pid($pid) {
+  $deploy_pid = &deploy_push_get_pid();
+  $deploy_pid = $pid;
+  variable_set('deploy_pid',$pid);
+}
+
+/**
+ * Get the server currently be targeted for a specific item deployment.
+ * 
+ * @todo complete the switch to session vars (incomplete)
+ *
+ * @access public
+ * @return int sid of current target server
+ */
+function &deploy_push_get_current_server() {
+  // static variable assigned to a SESSION var is new implemention
+  static $deploy_current_server;
+  if (isset($deploy_current_server)) return $deploy_current_server;
+  if (isset($_SESSION['deploy_current_server'])) 
+    $deploy_current_server = $_SESSION['deploy_current_server'];
+  elseif ($deploy_current_server = variable_get('deploy_server',NULL)) // being a little condensed here: set the static and check in one line
+    // if, for some reason, the var is set but not the session, call set current server to set up correctly
+    deploy_push_set_current_server($deploy_current_server); 
+  else
+    $deploy_current_server = NULL;
+  // return, either a val that we get from static, session or var, or NULL if not current server is set
+  // NOTE: if this is being used to set up a session, there should be some error checking here
+  return $deploy_current_server;
+}
+
+
+/**
+ * Set the server currently be targeted for a specific item deployment.
+ *
+ * Set global/static/session/drupal vars as needed so that all other deploy modules
+ * can operate on the correct target server for subsequent deploy item operations,
+ * until this function is called again.
+ * 
+ * @param mixed $sid 
+ *   Server ID that following deploy steps should target
+ * @access public
+ * @return void
+ */
+function deploy_push_set_current_server($server) {
+  // use a static that is assigned by reference to a session var
+  $deploy_current_server = deploy_push_get_current_server();
+  $deploy_current_server = $server;
+  // for legacy compatibility, set the variable to the server variable as well
+  variable_set('deploy_server',$deploy_current_server);
+}
+
+/**
+ * Get the current server target session's id
+ * 
+ * @todo refactor from variable_get to sessions with multi-site support
+ * @access public
+ * @return 
+ *   String sessid value
+ */
+function deploy_push_get_current_sessid() {
+  return variable_get('deploy_auth_sessid',NULL);
+}
+
+/**
+ * Set the sessid of the current target server so that it can easily be accessed by other deploy funcs
+ * 
+ * @param string $sid 
+ *   SESSID to set to
+ * @access public
+ * @return void
+ */
+function deploy_push_set_current_sessid($sid) {
+  variable_set('deploy_auth_sessid', $sid);
+}
+
+/**
+ * Log an error and set the "fatal" flag to halt batch processing, if error is fatal
+ * 
+ * @param string $module 
+ *   Name of "module" code for this message (deploy module, that is)
+ * @param string $description 
+ *   Log message desctiption
+ * @param string $message 
+ *   Additional info, error message, etc.
+ * @param bool $fatal 
+ *   Flag to be set for fatal errors, which will cause the batch to terminate.
+ * @access public
+ * @return void
+ */
+function deploy_push_error($module,$description,$message,$fatal=TRUE) {
+  if (!variable_get($deploy_fatal,FALSE) && $fatal) variable_set($deploy_fatal,TRUE);
+  deploy_push_log_detail($module, $deploy_fatal, 'Error', $message, $fatal);
+}
+
+/**
+ * Set the "fatal" flag used across all steps of the deploy to determine whether or not to terminate due to earlier error 
+ * 
+ * @param bool $fatal 
+ *   Status to set fatal flag to (TRUE will terminate deploy)
+ * @param bool $init 
+ *   If set, allow this function to erase previous deploy settings (used in plan init)
+ * @access public
+ * @return void
+ */
+function deploy_push_set_fatal($fatal=TRUE, $init=FALSE) {
+  // if another step has already set the fatal flag, don't let any subsequent ones override, unless we're init'ing
+  if ($init || !deploy_push_get_fatal()) variable_set('deploy_fatal',$fatal); 
+}
+
+/**
+ * Get the current status of the deplyment flag
+ * 
+ * @access public
+ * @return boolean value indicating whether or not there was a prior error. 
+ */
+function deploy_push_get_fatal() {
+  return variable_get('deploy_fatal',NULL);
+}
+
+/**
+ * Set the current deploy_log id, for use in all log cals for this deploy
+ * 
+ * @param int $id 
+ *   ID of log id
+ * @access public
+ * @return void
+ */
+function deploy_push_set_log_id($id) {
+  variable_set('deploy_log_id',$id);
+}
+
+/**
+ * Get the deploy_log id, for use in all log calls
+ * 
+ * @access public
+ * @return
+ *   int of deploy_log id
+ *
+ * @todo use session variable instead of variable_set/get
+ * @todo add some error checking here, what do we do if we don't find an ID? (tweak)
+ */
+function deploy_push_get_log_id() {
+  return variable_get('deploy_log_id',NULL);
+}
+
+/**
+ * Insert log message concerning the results of a specific deploy step or deploy error
+ * 
+ * @param string $module 
+ *   Name of "module" code for this message (deploy module, that is)
+ * @param string $description 
+ *   Log message desctiption
+ * @param string $message 
+ *   Additional info, error message, etc.
+ * @access public
+ * @return void
+ */
+function deploy_push_log_detail($module, $description, $result='Error', $message='') {
+  $deploy_log_id = deploy_push_get_log_id();
+  db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", $deploy_log_id, $module, $description, $result, $message);
+}
