 README.txt                                         |   2 +-
 class_media_mover_configuration.inc                |  30 ++-
 class_media_mover_file.inc                         |  12 +-
 class_media_mover_step.inc                         |  14 +-
 media_mover_api.drush.inc                          |  17 +-
 media_mover_api.install                            |   2 -
 media_mover_api.module                             | 159 ++++++------
 media_mover_ui/media_mover_ui.info                 |   6 +-
 media_mover_ui/media_mover_ui.module               | 275 +++++++++++----------
 media_mover_ui/media_mover_ui.theme.inc            |  48 ++--
 .../media-mover-configuration-wrapper.tpl.php      |   2 -
 .../theme/media-mover-configuration.tpl.php        |   2 -
 .../theme/media-mover-configurations.tpl.php       |   2 -
 tests/media_mover_api.test                         |  34 +--
 tests/mm_test.module                               |   4 +-
 15 files changed, 307 insertions(+), 302 deletions(-)

diff --git a/README.txt b/README.txt
index 6ccd69f..430e398 100644
--- a/README.txt
+++ b/README.txt
@@ -33,7 +33,7 @@ for that video.
 
 Media Mover configurations will be run every time cron is run, though you
 can run a single configuration by hand if you use the run option at 
-admin/media_mover
+admin/config/media/media_mover
 
  Example:
  ------------------------------------
diff --git a/class_media_mover_configuration.inc b/class_media_mover_configuration.inc
index f7c9b52..98f77b2 100644
--- a/class_media_mover_configuration.inc
+++ b/class_media_mover_configuration.inc
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  * Base class for media mover configurations
@@ -38,11 +36,11 @@ class media_mover_configuration {
    */
   function load($cid) {
     // Get the configuration data
-    $result = db_query("SELECT * FROM {media_mover_configurations} WHERE cid = :cid", array(
-      ':cid' => $cid)
-    );
-
-    if (! $data = $result->fetchObject()) {
+    $query = db_select('media_mover_configurations', 'mmc')
+      ->fields('mmc')
+      ->condition('cid', $cid);
+    $result = $query->execute();
+    if (!($data = $result->fetchObject())) {
       return FALSE;
     }
 
@@ -248,7 +246,7 @@ class media_mover_configuration {
    *   Object or string
    * @param $severity
    */
-  function log($message, $variables, $type = 'NA' , $severity = WATCHDOG_INFO) {
+  function log($message, $variables, $type = 'NA', $severity = WATCHDOG_INFO) {
     // Get the human readable name for this severity
     $severities = watchdog_severity_levels();
     if (! $level = $severities[$severity]) {
@@ -261,7 +259,7 @@ class media_mover_configuration {
         $type = 'mm configuration: ' . $type->cid;
       }
       elseif (get_class($type) == 'media_mover_step') {
-        $type = 'mm step: ' . $type->step_order . ' ' . $type->build['description'] . ' (' . $type->sid .')';
+        $type = 'mm step: ' . $type->step_order . ' ' . $type->build['description'] . ' (' . $type->sid . ')';
       }
       elseif (get_class($type) == 'media_mover_file') {
         $type = 'mm file: ' . $type->mmfid;
@@ -397,7 +395,13 @@ class media_mover_configuration {
   function reset() {
     $this->delete_files();
 
-    db_query('UPDATE {media_mover_steps} SET start_time = 0, stop_time = 0 WHERE cid = :cid', array(':cid' => $this->cid));
+    db_update('media_mover_steps')
+      ->fields(array(
+        'start_time' => 0,
+        'stop_time' => 0,
+      ))
+      ->condition('cid', $this->cid)
+      ->execute();
   }
 
 
@@ -432,9 +436,9 @@ class media_mover_configuration {
       $step->delete();
     }
 
-    db_query('DELETE FROM {media_mover_configurations} WHERE cid = :cid', array(
-      ':cid' => $this->cid)
-    );
+    db_delete('media_mover_configurations')
+      ->condition('cid', $this->cid)
+      ->execute();
   }
 
 }
diff --git a/class_media_mover_file.inc b/class_media_mover_file.inc
index c5b4b15..7611966 100644
--- a/class_media_mover_file.inc
+++ b/class_media_mover_file.inc
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  * Base class for media mover files
@@ -91,7 +89,7 @@ class media_mover_file {
     }
 
     if (empty($this->date)) {
-      $this->date = time();
+      $this->date = REQUEST_TIME;
     }
     if (empty($this->source_uri)) {
       $this->source_uri = $this->uri;
@@ -158,7 +156,7 @@ class media_mover_file {
    */
   function lock() {
     if (! $this->locked()) {
-      $this->lock_date = time();
+      $this->lock_date = REQUEST_TIME;
       // Was the status correctly set?
       return $this->status_set('*');
     }
@@ -335,7 +333,7 @@ class media_mover_file {
       $this->step_order = $this->step_order + 1;
     }
     // This is the final step.
-    else  {
+    else {
       $this->status = MMA_FILE_STATUS_FINISHED;
       $this->lock_date = 0;
     }
@@ -398,7 +396,9 @@ class media_mover_file {
     }
 
     // Remove the file from the database
-    db_query("DELETE FROM {media_mover_files} WHERE mmfid = :mmfid", array(':mmfid' => $this->mmfid));
+    db_delete('media_mover_files')
+      ->condition('mmfid', $this->mmfid)
+      ->execute();
   }
 
 
diff --git a/class_media_mover_step.inc b/class_media_mover_step.inc
index a3fa8f3..6ede302 100644
--- a/class_media_mover_step.inc
+++ b/class_media_mover_step.inc
@@ -45,7 +45,7 @@ class media_mover_step {
     // Add the values to the proper parts of the object
     foreach ($build as $key => $value) {
       // Ensure that these values are placed at the top of the object
-      // @TODO this shoud be depricated
+      // @TODO this shoud be deprecated
       if ($key == 'build' && is_array($value)) {
         $this->module = $value['module'];
         $this->action_id = $value['action_id'];
@@ -53,7 +53,7 @@ class media_mover_step {
       if ($key == 'description' && empty($this->name)) {
         $this->name = $value;
       }
-      // @TODO This should be depricated
+      // @TODO This should be deprecated
       if ($key == 'settings') {
         $this->settings = $value;
       }
@@ -119,9 +119,9 @@ class media_mover_step {
    * Delete this step from the DB
    */
   function delete() {
-    db_query('DELETE FROM {media_mover_steps} WHERE sid = :sid', array(
-      ':sid' => $this->sid)
-    );
+    db_delete('media_mover_steps')
+      ->condition('sid', $this->sid)
+      ->execute();
   }
 
 
@@ -268,7 +268,7 @@ class media_mover_step {
   }
 
 
- /**
+  /**
    * Starts the run of a specified step. Will lock the status
    * and set the start/stop times
    *
@@ -291,7 +291,7 @@ class media_mover_step {
         $this->status = MMA_STEP_STATUS_RUNNING;
         // Set the stop time to the last time this started
         $this->stop_time = $this->start_time;
-        $this->start_time = time();
+        $this->start_time = REQUEST_TIME;
         // Save the status
         drupal_write_record('media_mover_steps', $this, array('sid'));
         return TRUE;
diff --git a/media_mover_api.drush.inc b/media_mover_api.drush.inc
index 8ae316b..f4087a2 100644
--- a/media_mover_api.drush.inc
+++ b/media_mover_api.drush.inc
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  *
@@ -145,7 +143,7 @@ function drush_media_mover_api_media_mover_queue_run() {
   // @TODO might be nice to borrow from the migration module for the memory
   //       management
   if (ini_get('max_execution_time') < 240 && !ini_get('safe_mode')) {
-    set_time_limit(240);
+    drupal_set_time_limit(240);
   }
 
   // Get all the Media Mover queues
@@ -156,9 +154,9 @@ function drush_media_mover_api_media_mover_queue_run() {
   foreach ($queues as $queue_name => $info) {
     drush_print("Running queue worker: $queue_name");
     $function = $info['worker callback'];
-    $end = time() + (isset($info['time']) ? $info['time'] : 15);
+    $end = REQUEST_TIME + (isset($info['time']) ? $info['time'] : 15);
     $queue = DrupalQueue::get($queue_name);
-    while (time() < $end && ($item = $queue->claimItem())) {
+    while (REQUEST_TIME < $end && ($item = $queue->claimItem())) {
       $function($item->data);
       $queue->deleteItem($item);
     }
@@ -260,7 +258,7 @@ function drush_media_mover_api_media_mover_config_purge($configuration) {
 
   // Try to increase the maximum execution time if it is too low.
   if (ini_get('max_execution_time') < 240 && !ini_get('safe_mode')) {
-    set_time_limit(240);
+    drupal_set_time_limit(240);
   }
 
   // Get all the Media Mover queues
@@ -272,9 +270,9 @@ function drush_media_mover_api_media_mover_config_purge($configuration) {
   foreach ($queues as $queue_name => $info) {
     drush_print("Running queue worker: $queue_name");
     $function = $info['worker callback'];
-    $end = time() + (isset($info['time']) ? $info['time'] : 15);
+    $end = REQUEST_TIME + (isset($info['time']) ? $info['time'] : 15);
     $queue = DrupalQueue::get($queue_name);
-    while (time() < $end && ($item = $queue->claimItem())) {
+    while (REQUEST_TIME < $end && ($item = $queue->claimItem())) {
       $function($item->data);
       $queue->deleteItem($item);
     }
@@ -306,7 +304,8 @@ function drush_media_mover_api_media_mover_config_delete($configuration) {
 function drush_media_mover_api_media_mover_run($configuration = FALSE, $step = FALSE) {
   if ($all = drush_get_option('all')) {
     $configurations = media_mover_api_configurations_load(MMA_CONFIG_STATUS_ENABLED);
-  } else {
+  }
+  else {
     if (! $configuration) {
       drush_die('No configuration specified.');
       return;
diff --git a/media_mover_api.install b/media_mover_api.install
index f25b93b..40afcb1 100644
--- a/media_mover_api.install
+++ b/media_mover_api.install
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  */
diff --git a/media_mover_api.module b/media_mover_api.module
index 4d220bb..5fe3d39 100644
--- a/media_mover_api.module
+++ b/media_mover_api.module
@@ -7,14 +7,14 @@
  * This file provides an interface to the media mover objects (configurations, steps, files).
  */
 
- /**
-  * @TODO Document Document Document
-  * @TODO Improve select ops to declare if they can run on a single node
-  * @TODO Add simple tests for API intgrity
-  *
-  * @TODO rename "steps" "actions" and replace current "action" with "action_id"
-  *
-  */
+/**
+ * @TODO Document Document Document
+ * @TODO Improve select ops to declare if they can run on a single node
+ * @TODO Add simple tests for API integrity
+ *
+ * @TODO rename "steps" "actions" and replace current "action" with "action_id"
+ *
+ */
 
 
 /* ************************************************ */
@@ -24,6 +24,9 @@
 // Files directory
 define('MMA_FILES_DIR', 'media_mover');
 
+// Path to all configuration pages
+define('MMA_CONFIG_PATH', 'admin/config/media/media_mover');
+
 // Defines the configuration status
 define('MMA_CONFIG_STATUS_DISABLED', 'disabled');
 // Standard configuration status
@@ -86,7 +89,7 @@ function media_mover_api_cron() {
 
 
 /**
- * Implementation of hook_cron_queue_info().
+ * Implements hook_cron_queue_info().
  */
 function media_mover_api_cron_queue_info() {
   $queues['media_mover_api_configuration_process'] = array(
@@ -125,7 +128,7 @@ function media_mover_api_configuration_code_validate($configuration) {
   // Investigate each of the steps
   foreach ($configuration->steps as $step) {
     // Do a module dependency check
-    if (! module_exists($step->build['module'])) {
+    if (!module_exists($step->build['module'])) {
       watchdog('media_mover_api', t('The module: %module is required for this configuration but is not installed.
         In order to use this configuration you will need to install it.', array(
           '%module' => $import_step->module,
@@ -198,7 +201,7 @@ function media_mover_api_queue_file_process_worker($file) {
 function media_mover_api_queue_file_delete_worker($file) {
   $file->delete();
   // Clear any file caches
-  cache_clear_all('media_mover_files_'. $file->mmfid, 'cache_media_mover', TRUE);
+  cache_clear_all('media_mover_files_' . $file->mmfid, 'cache_media_mover', TRUE);
 }
 
 
@@ -247,7 +250,7 @@ function media_mover_api_step_configuration_get($action_string, $action_id = FAL
  * @return array
  */
 function media_mover_api_action_build_get($module, $id = FALSE) {
-  if (! $id) {
+  if (!$id) {
     $data = explode('--', $module);
     $module = $data[0];
     $id = $data[1];
@@ -269,7 +272,7 @@ function media_mover_api_action_build_get($module, $id = FALSE) {
  */
 function media_mover_api_actions_build_get($type = MMA_ACTION_TYPE_NORMAL, $request_module = FALSE, $request_action_id = FALSE) {
   static $data;
-  if (! $data) {
+  if (!$data) {
     $data = array(
       MMA_ACTION_TYPE_NORMAL => array(),
       MMA_ACTION_TYPE_SELECT => array(),
@@ -386,7 +389,7 @@ function media_mover_api_dir_path1($uri = NULL, $create = TRUE) {
   // Path is relative to drupal files dir
   $path =  MMA_FILES_DIR . '/' . $file->cid . '/' . $step->sid . '/';
 
-  print  file_build_uri($uri);
+  print file_build_uri($uri);
 
   print $path . "\n\n";
   if ($uri) {
@@ -467,10 +470,10 @@ function media_mover_api_set_file_perm($uri) {
  * @return boolean
  */
 function media_mover_api_file_validate_extensions($uri, $extensions = FALSE) {
-  if (! $extensions) {
+  if (!$extensions) {
     return TRUE;
   }
-  $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
+  $regex = '/\.(' . ereg_replace(' +', '|', preg_quote($extensions)) . ')$/i';
   if (preg_match($regex, basename($uri))) {
     return TRUE;
   }
@@ -537,7 +540,7 @@ function media_mover_api_configuration_machine_name_exists($string) {
   // Keep an internal store of step names so that form building can check names
   // that have not been saved to the database yet.
   static $strings = array();
-  if (! empty($strings[$string])) {
+  if (!empty($strings[$string])) {
     return TRUE;
   }
   $strings[$string] = $string;
@@ -563,7 +566,7 @@ function media_mover_api_step_machine_name_exists($string) {
   // Keep an internal store of step names so that form building can check names
   // that have not been saved to the database yet.
   static $strings = array();
-  if (! empty($strings[$string])) {
+  if (!empty($strings[$string])) {
     return TRUE;
   }
   $strings[$string] = $string;
@@ -608,23 +611,22 @@ function media_mover_api_file_status($status = NULL) {
 /**
  * Selects multiple files. Used for the simplest cases
  *
- * @param array $options
- *   Options to select by
+ * @param array $conditions
+ *   Array of conditions to select by, each condition is an associative
+ *   array with keys 'field', 'value', 'operator'.
  * @return array of files
  */
 function media_mover_api_files_get($conditions = array()) {
-  $query = db_query('media_mover_files', 'mmf');
-  $query->fields('mmf', array('mmfid'));
-  $query->condition('mmf.cid', $this->cid);
+  $query = db_select('media_mover_files', 'mmf')
+    ->fields('mmf', array('mmfid'));
+//?  $query->condition('mmf.cid', $this->cid);
 
   // Default conditions
   $defaults = array(
-    'field' => 'status',
-    'value' => MMA_FILE_STATUS_READY,
-    'operator' => '='
+    array('field' => 'status', 'value' => MMA_FILE_STATUS_READY, 'operator' => '=')
   );
 
-  $condtions = array_merge($defaults, $condtions);
+  $conditions = array_merge($defaults, $conditions);
   foreach ($conditions as $condition) {
     $query->condition($condition['field'], $condition['value'], $condition['operator']);
   }
@@ -632,12 +634,10 @@ function media_mover_api_files_get($conditions = array()) {
   $results = $query->execute();
 
   // Find all matching files
-  $results = db_query("SELECT mmfid FROM {media_mover_files} ". $options . $file_limit);
   // put files into an array
   $items = array();
-  foreach ($results as $result) {
-    $item = media_mover_api_file_load($result->mmfid, TRUE);
-    $items[] = $item;
+  while ($result = $results->fetchObject()) {
+    $items[] = media_mover_api_file_load($result->mmfid, TRUE);
   }
   return $items;
 }
@@ -668,7 +668,7 @@ function media_mover_api_file_load($mmfid, $cache = TRUE) {
     return FALSE;
   }
 
-  if (! empty($file->errors)) {
+  if (!empty($file->errors)) {
     watchdog('media_mover_api', implode('<br />'), $this->errors, WATCHDOG_ERROR);
     return FALSE;
   }
@@ -686,17 +686,17 @@ function media_mover_api_file_load($mmfid, $cache = TRUE) {
  * @TODO setup caching!
  */
 function media_mover_api_file_get_fid($fid, $module = FALSE, $reset = FALSE) {
-  if (! $module) {
-    $results = db_query('SELECT mmfid FROM {media_mover_files} WHERE fid = %d', $nid);
+  if (!$module) {
+    $results = db_query('SELECT mmfid FROM {media_mover_files} WHERE fid = :fid', array(':fid' => $nid));
   }
-  elseif ($module) {
+  else {
     $results = db_query("SELECT mmf.mmfid FROM {media_mover_files} mmf
       LEFT JOIN {media_mover_steps} mms ON mms.cid = mmf.cid
-      WHERE mms.module = '%s' AND
-        mmf.fid = %d", $module, $fid);
+      WHERE mms.module = :mms.module AND mmf.fid = :mmf.fid",
+      array(':mms.module' => $module, ':mmf.fid' => $fid));
   }
-
-  while ($result = db_result($results)) {
+  $results->execute();
+  while ($result = $results->fetchField()) {
     $files[$result] = media_mover_api_file_load($result);
   }
   return $files;
@@ -715,7 +715,7 @@ function media_mover_api_file_get_fid($fid, $module = FALSE, $reset = FALSE) {
  * @return $new_file
  *   Object, media mover file
  */
-function media_mover_api_file_create_derivative($file, $new_uri = FALSE,  $status = MMA_FILE_STATUS_READY) {
+function media_mover_api_file_create_derivative($file, $new_uri = FALSE, $status = MMA_FILE_STATUS_READY) {
   // Create a copy of the current file that will be the derivative
   $new_mmfile = clone $file;
   // Remove the ID so we can save as a new file
@@ -774,17 +774,15 @@ function media_mover_api_file_is_local($uri) {
 function media_mover_api_configurations_load($status = FALSE) {
   $configurations = array();
   // Load by status
+  $query = db_select('media_mover_configurations', 'mmc')
+    ->fields('mmc', array('cid'));
   if ($status) {
-    $results = db_query('SELECT cid FROM {media_mover_configurations} mmc WHERE mmc.status = :status', array(
-      ':status' => $status));
+      $query->condition('status', $status);
   }
   // Load all configurations that are not disabled
-  else {
-    $results = db_query('SELECT cid FROM {media_mover_configurations} mmc');
-  }
+  $results = $query->execute();
   if ($results) {
-    $configurations = array();
-    foreach ($results->fetchAll() as $record) {
+    while ($record = $results->fetchObject()) {
       $configurations[$record->cid] = media_mover_api_configuration_load($record->cid);
     }
   }
@@ -831,13 +829,13 @@ function media_mover_api_configurations_get_by_module($module_name, $action = NU
   $results = db_query('SELECT sid FROM {media_mover_steps} WHERE ' . implode(' AND ', $conditions), array(
     ':module' => $module_name,
     ':action' => $action
-  ));
-  foreach($results->fetchArray() as $record) {
+  ))->execute();
+  while ($record = $results->fetchAssoc()) {
     // Now we find all of the configurations that utilize this step
-    $configurations = db_query("SELECT cid FROM {media_mover_steps} WHERE sid = :s", array(
+    $configurations = db_query("SELECT cid FROM {media_mover_steps} WHERE sid = :sid", array(
       ':sid' => $result['sid']
-    ));
-    while ($cid = db_result($configurations)) {
+    ))->execute();
+    while ($cid = $configurations->fetchField()) {
       $configuration = media_mover_api_configuration_load($cid);
       $options[$configuration->cid] = $configuration->name;
     }
@@ -855,8 +853,8 @@ function media_mover_api_configurations_get_by_module($module_name, $action = NU
  */
 function media_mover_api_configurations_by_sid($sid) {
   $configurations = array();
-  $results = db_query('SELECT cid FROM {media_mover_steps} WHERE sid = :sid', array(':sid' => $sid));
-  while ($cid = db_result($results)) {
+  $results = db_query('SELECT cid FROM {media_mover_steps} WHERE sid = :sid', array(':sid' => $sid))->execute();
+  while ($cid = $results->fetchField()) {
     $configurations[$cid] = media_mover_api_configuration_load($cid);
   }
   return $configurations;
@@ -875,8 +873,9 @@ function media_mover_api_configuration_stats($configuration, $status = NULL) {
     $steps = $configuration->steps;
   }
   foreach ($steps as $step) {
-    $results = db_query('SELECT status, count(mmfid) AS count FROM {media_mover_files} WHERE cid = "%s" AND step_order = %d GROUP BY status', $configuration->cid, $step->step_order+1);
-    while ($result = db_fetch_array($results)) {
+    $results = db_query('SELECT status, count(mmfid) AS count FROM {media_mover_files} WHERE cid = :cid AND step_order = :step_order GROUP BY status',
+      array(':cid' => $configuration->cid, ':step_order' => $step->step_order + 1))->execute();
+    while ($result = $results->fetchAssoc()) {
       $stats[$step->build['description']] = $result;
     }
   }
@@ -911,7 +910,7 @@ function media_mover_api_configuration_status($status = NULL) {
  * Utility function to set the status of DB or code configuration
  */
 function media_mover_api_configuration_status_set($status, &$configuration) {
-   // Ensure that we are changing the status correctly for
+  // Ensure that we are changing the status correctly for
   // configurations in code
   switch ($status) {
     case MMA_CONFIG_STATUS_ENABLED:
@@ -923,7 +922,7 @@ function media_mover_api_configuration_status_set($status, &$configuration) {
       elseif ($configuration->status == MMA_CONFIG_STATUS_OVERRIDDEN_DISABLED) {
         $status = MMA_CONFIG_STATUS_OVERRIDDEN;
       }
-    break;
+      break;
 
     // No changes are needed for disabling
     case MMA_CONFIG_STATUS_DISABLED:
@@ -935,7 +934,7 @@ function media_mover_api_configuration_status_set($status, &$configuration) {
       elseif ($configuration->status == MMA_CONFIG_STATUS_OVERRIDDEN) {
         $status = MMA_CONFIG_STATUS_OVERRIDDEN_DISABLED;
       }
-    break;
+      break;
   }
   $configuration->status = $status;
 }
@@ -962,7 +961,7 @@ function media_mover_api_configurations_load_from_code() {
   $code_configurations = media_mover_api_configurations_fetch_in_code();
   foreach ($code_configurations as $cid => $code_configuration) {
     // Check to see if this configuration exists in the DB
-    if (! $configurations[$cid]) {
+    if (!$configurations[$cid]) {
       // This configuration comes from code
       $code_configuration->status = MMA_CONFIG_STATUS_DEFAULT;
       $code_configuration->save();
@@ -983,7 +982,7 @@ function media_mover_api_configurations_unload_from_code() {
     // Search for configurations in code
     if ($configurations[$cid]->status == MMA_CONFIG_STATUS_DEFAULT) {
       // Check to see if this code configuration exists
-      if (! $code_configurations[$cid]) {
+      if (!$code_configurations[$cid]) {
         $configuration[$cid]->delete();
       }
     }
@@ -997,7 +996,7 @@ function media_mover_api_configurations_unload_from_code() {
  * @return $array of configuration objects
  */
 function media_mover_api_configurations_fetch_in_code($modules = FALSE) {
-  if (! $modules) {
+  if (!$modules) {
     $modules = module_list();
   }
   $configurations = array();
@@ -1015,14 +1014,12 @@ function media_mover_api_configurations_fetch_in_code($modules = FALSE) {
         'status' => MMA_CONFIG_STATUS_DEFAULT,
       );
       $configurations[$configuration->cid] = $configuration;
-       /*
       if (media_mover_api_configuration_code_validate($configuration)) {
         $configurations[$configuration->cid] = $configuration;
       }
       else {
         watchdog('media_mover_api', t('%path was an invalid configuration.', array('%path' => $file->path)), WATCHDOG_ERROR);
       }
-      */
     }
   }
   return $configurations;
@@ -1035,10 +1032,10 @@ function media_mover_api_configurations_fetch_in_code($modules = FALSE) {
  */
 function media_mover_api_steps_get() {
   static $steps;
-  if (! $steps) {
+  if (!isset($steps)) {
     $steps = array();
-    $results = db_query('SELECT sid FROM {media_mover_steps}');
-    while ($sid = db_result($results)) {
+    $results = db_query('SELECT sid FROM {media_mover_steps}')->execute();
+    while ($sid = $results->fetchField()) {
       $steps[$sid] = media_mover_api_step_get($sid);
     }
   }
@@ -1137,19 +1134,19 @@ function media_mover_api_xspf_playlist_thumbnail($op, $node = NULL, $config = NU
     case 'define':
       $configurations = media_mover_api_configurations_load();
       foreach ($configurations as $configuration ) {
-        $define['media_mover_api--'. $configuration->cid] = t('Media Mover: ') . $configuration->name;
+        $define['media_mover_api--' . $configuration->cid] = t('Media Mover: ') . $configuration->name;
       }
       return $define;
-    break;
+      break;
 
     case 'return':
       if ($file = $node->media_mover[$config][0]['complete_file']) {
-        if (! strstr($file, 'http://')) {
+        if (!strstr($file, 'http://')) {
           $file = file_create_url($file);
         }
         return $file;
       }
-    break;
+      break;
   }
 }
 
@@ -1159,18 +1156,18 @@ function media_mover_api_xspf_playlist_thumbnail($op, $node = NULL, $config = NU
  */
 function media_mover_api_xspf_playlist_use($op, $node, $config) {
   switch ($op) {
-    case 'define' :
+    case 'define':
       $configurations = media_mover_api_configurations_load();
       foreach ($configurations as $configuration ) {
-        $define['media_mover_api--'. $configuration->cid] = t('Media Mover: ') . $configuration->name;
+        $define['media_mover_api--' . $configuration->cid] = t('Media Mover: ') . $configuration->name;
       }
       return $define;
-    break;
+      break;
 
     case 'views':
       $conditions = '%s.nid = node.nid';
       return array('tablename' => 'media_mover_files', 'conditions' => $conditions);
-    break;
+      break;
 
     case 'return':
       // get files for the running configuration
@@ -1181,7 +1178,7 @@ function media_mover_api_xspf_playlist_use($op, $node, $config) {
           // Make sure that the file path is complete
           $pattern = '/http.?\:\/\//';
           $url = preg_match($pattern, $uri);
-          if (! $url) {
+          if (!$url) {
             $uri = file_create_url($uri);
           }
           // only add the file if we have an incoming item
@@ -1192,13 +1189,13 @@ function media_mover_api_xspf_playlist_use($op, $node, $config) {
         }
         return $items;
       }
-    break;
+      break;
   }
 }
 
 
 /**
- * Implementation of hook_ctools_plugin_api().
+ * Implements hook_ctools_plugin_api().
  *
  * Tell CTools that we support the default_mymodule_presets API.
  */
@@ -1209,18 +1206,18 @@ function media_mover_api_ctools_plugin_api($owner, $api) {
 }
 
 /**
- * Implementation of hook_ctools_plugin_directory().
+ * Implements hook_ctools_plugin_directory().
  */
 function media_mover_api_ctools_plugin_directory($module, $type) {
   // Load the export_ui plugin.
-  if ($type =='export_ui') {
+  if ($type == 'export_ui') {
 //    return 'plugins/export_ui';
   }
 }
 
 
 /**
- * Implementation of hook_default_mymodule_preset().
+ * Implements hook_default_mymodule_preset().
  *
  * Provide a couple of default presets.
  */
diff --git a/media_mover_ui/media_mover_ui.info b/media_mover_ui/media_mover_ui.info
index 86a43fe..a28f74f 100644
--- a/media_mover_ui/media_mover_ui.info
+++ b/media_mover_ui/media_mover_ui.info
@@ -1,6 +1,8 @@
-name = " Media Mover UI"
+name = "Media Mover UI"
 description = Provides user interface to Media Mover functionality
 package = "Media Mover"
 dependencies[] = media_mover_api
 core = 7.x
-php = 5.2
\ No newline at end of file
+php = 5.2
+configure = admin/config/media/media_mover
+
diff --git a/media_mover_ui/media_mover_ui.module b/media_mover_ui/media_mover_ui.module
index 664bf33..a19b5c9 100644
--- a/media_mover_ui/media_mover_ui.module
+++ b/media_mover_ui/media_mover_ui.module
@@ -26,10 +26,10 @@
  */
 function media_mover_ui_menu() {
   // ------------------------------------------------
-  // MAIN TABS for admin/media_mover
+  // MAIN TABS for MMA_CONFIG_PATH
 
   // Media Mover landing page
-  $items['admin/config/media/media-mover'] = array(
+  $items[MMA_CONFIG_PATH] = array(
     'title' => 'Media Mover',
     'page callback' => 'media_mover_ui_configurations_view',
     'access arguments' => array('administer media_mover'),
@@ -37,7 +37,7 @@ function media_mover_ui_menu() {
   );
 
   // Render landing page as the default tab
-  $items['admin/config/media/media-mover/default'] = array(
+  $items[MMA_CONFIG_PATH . '/default'] = array(
     'title' => 'Configurations',
     'page callback' => 'media_mover_ui_landing_page',
     'type' => MENU_DEFAULT_LOCAL_TASK,
@@ -45,7 +45,7 @@ function media_mover_ui_menu() {
   );
 
   // Add a new configuration
-  $items['admin/config/media/media-mover/add'] = array(
+  $items[MMA_CONFIG_PATH . '/add'] = array(
     'title' => 'Add',
     'page callback' => 'drupal_get_form',
     'access arguments' => array('administer media_mover'),
@@ -55,7 +55,7 @@ function media_mover_ui_menu() {
   );
 
   // Settings main tab
-  $items['admin/config/media/media-mover/settings'] = array(
+  $items[MMA_CONFIG_PATH . '/settings'] = array(
     'title' => 'Media Mover settings',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('media_mover_ui_admin_settings'),
@@ -64,7 +64,7 @@ function media_mover_ui_menu() {
   );
 
   // Settings main tab defaults
-  $items['admin/config/media/media-mover/settings/media_mover_api'] = array(
+  $items[MMA_CONFIG_PATH . '/settings/media_mover_api'] = array(
     'title' => 'Defaults',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('media_mover_ui_admin_settings'),
@@ -74,19 +74,19 @@ function media_mover_ui_menu() {
   );
 
   // Tools main tab
-  $items['admin/config/media/media-mover/tools'] = array(
+  $items[MMA_CONFIG_PATH . '/tools'] = array(
     'title' => 'Tools',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('media_mover_ui_admin_settings'),
+    'page arguments' => array('media_mover_ui_admin_tools_form'),
     'access arguments' => array('administer media_mover'),
     'type' => MENU_LOCAL_TASK,
   );
 
   // Tools default tab
-  $items['admin/config/media/media-mover/tools/default'] = array(
+  $items[MMA_CONFIG_PATH . '/tools/default'] = array(
     'title' => 'Tools',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('media_mover_ui_admin_settings'),
+    'page arguments' => array('media_mover_ui_admin_tools_form'),
     'access arguments' => array('administer media_mover'),
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -1,
@@ -96,7 +96,7 @@ function media_mover_ui_menu() {
   // File menu items
 
   // Files as a tab
-  $items['admin/config/media/media-mover/files'] = array(
+  $items[MMA_CONFIG_PATH . '/files'] = array(
     'title' => 'Files',
     'page callback' => 'media_mover_ui_files_list',
     'access arguments' => array('administer media_mover'),
@@ -107,12 +107,12 @@ function media_mover_ui_menu() {
   // Configuration menu items
 
   // Add the configuration pages to the menu tree
-  $items['admin/config/media/media-mover/configuration'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration'] = array(
     'type' => MENU_LOCAL_TASK,
   );
 
   // Configuration landing page
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration'] = array(
     'title' => 'Configuration',
     'title callback' => 'media_mover_ui_menu_configuration_title_callback',
     'title arguments' => array(5),
@@ -126,7 +126,7 @@ function media_mover_ui_menu() {
 
   // We do not want to render tabs unless we are on a config page
   // Configuration view tab
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/view'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/view'] = array(
     'title' => 'Configuration',
     'title callback' => 'media_mover_ui_menu_configuration_title_callback',
     'title arguments' => array(5),
@@ -139,7 +139,7 @@ function media_mover_ui_menu() {
   );
 
   // Edit tab for a configuration
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/edit'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/edit'] = array(
     'title' => 'Edit Configuration',
     'page callback' => 'drupal_get_form',
     'access arguments' => array('administer media_mover'),
@@ -148,7 +148,7 @@ function media_mover_ui_menu() {
   );
 
   // Run tab for a configuration
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/run'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/run'] = array(
     'title' => 'Run',
     'page callback' => 'media_mover_ui_configuration_run',
     'access arguments' => array('administer media_mover'),
@@ -157,16 +157,16 @@ function media_mover_ui_menu() {
   );
 
   // File tab for a configuration
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/files'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/files'] = array(
     'title' => 'Files',
     'page callback' => 'media_mover_ui_files_list',
     'access arguments' => array('administer media_mover'),
-    'page arguments' => array(5,7),
+    'page arguments' => array(5, 7),
     'type' => MENU_LOCAL_TASK,
   );
 
   // Reset all the step statuses
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/steps_reset'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/steps_reset'] = array(
     'title' => 'Reset steps',
     'page callback' => 'media_mover_ui_config_steps_reset',
     'access arguments' => array('administer media_mover'),
@@ -175,7 +175,7 @@ function media_mover_ui_menu() {
   );
 
   // Change the status of a media mover configuration (enable/disable)
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/status'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/status'] = array(
     'title' => 'Status change',
     'page callback' => 'media_mover_ui_configuration_status_change',
     'access arguments' => array('administer media_mover'),
@@ -184,7 +184,7 @@ function media_mover_ui_menu() {
   );
 
   // clear non finished files for a config
-  $items['admin/config/media/media-mover/configuration/%/files/clear'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%/files/clear'] = array(
     'title' => 'Files',
     'page callback' => 'media_mover_ui_config_files_clear',
     'access arguments' => array('administer media_mover'),
@@ -192,7 +192,7 @@ function media_mover_ui_menu() {
   );
 
   // delete an existing configuration
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/delete'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/delete'] = array(
     'title' => 'Confirm Configuration Deletion',
     'page callback' => 'drupal_get_form',
     'access arguments' => array('administer media_mover'),
@@ -200,7 +200,7 @@ function media_mover_ui_menu() {
   );
 
   // Empty an existing configuration of files
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/empty'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/empty'] = array(
     'title' => 'Confirm Configuration Deletion',
     'page callback' => 'drupal_get_form',
     'access arguments' => array('administer media_mover'),
@@ -208,7 +208,7 @@ function media_mover_ui_menu() {
   );
 
   // Clone an existing configuration
-  $items['admin/config/media/media-mover/configuration/%media_mover_api_configuration/clone'] = array(
+  $items[MMA_CONFIG_PATH . '/configuration/%media_mover_api_configuration/clone'] = array(
     'title' => 'Clone Configuration',
     'page callback' => 'media_mover_ui_config_clone',
     'access arguments' => array('administer media_mover'),
@@ -219,7 +219,7 @@ function media_mover_ui_menu() {
   // File tasks
 
   // Files status
-  $items['admin/config/media/media-mover/files/status'] = array(
+  $items[MMA_CONFIG_PATH . '/files/status'] = array(
     'title' => 'File Status',
     'page callback' => 'media_mover_ui_files_status',
     'access arguments' => array('administer media_mover'),
@@ -227,7 +227,7 @@ function media_mover_ui_menu() {
   );
 
   // Edit a file
-  $items['admin/config/media/media-mover/file/%media_mover_api_file/edit'] = array(
+  $items[MMA_CONFIG_PATH . '/file/%media_mover_api_file/edit'] = array(
     'title callback' => 'media_mover_ui_menu_file_title_callback',
     'title arguments' => array(5),
     'page callback' => 'drupal_get_form',
@@ -237,7 +237,7 @@ function media_mover_ui_menu() {
   );
 
   // delete a file
-  $items['admin/config/media/media-mover/file/%media_mover_api_file/delete'] = array(
+  $items[MMA_CONFIG_PATH . '/file/%media_mover_api_file/delete'] = array(
     'title' => 'Delete File',
     'page callback' => 'drupal_get_form',
     'access arguments' => array('administer media_mover'),
@@ -262,13 +262,18 @@ function media_mover_ui_menu() {
 
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  *
  * @ingroup drupal_hooks
  * @return array
  */
-function media_mover_ui_perm() {
-  return array('administer media_mover');
+function media_mover_ui_permission() {
+  return array(
+    'administer media_mover' => array(
+      'title' => t('administer media_mover'),
+      'description' => t('Administer Media Mover configuration'),
+    ),
+  );
 }
 
 /**
@@ -279,25 +284,25 @@ function media_mover_ui_perm() {
 function media_mover_ui_theme() {
   return array(
     'media_mover_ui_configuration_action_select' => array(
-      'arguments' => array('element' => NULL),
+      'variables' => array('element' => NULL),
       'file' => 'media_mover_ui.theme.inc',
     ),
     'media_mover_ui_configurations_list' => array(
-      'arguments' => array('configurations' => NULL),
+      'variables' => array('configurations' => NULL),
       'template' => 'theme/media-mover-configurations',
     ),
     'media_mover_ui_configuration_landing' => array(
-      'arguments' => array('header_ops' => NULL, 'configuration' => NULL, 'content' => NULL, 'ops' => NULL),
+      'variables' => array('header_ops' => NULL, 'configuration' => NULL, 'content' => NULL, 'ops' => NULL),
       'template' => 'theme/media-mover-configuration',
       'file' => 'media_mover_ui.theme.inc',
     ),
-    'media_mover_ui_configuration_wrapper' => array (
-      'arguments' => array('header_ops' => NULL, 'configuration' => NULL, 'content' => NULL),
+    'media_mover_ui_configuration_wrapper' => array(
+      'variables' => array('header_ops' => NULL, 'configuration' => NULL, 'content' => NULL),
       'template' => 'theme/media-mover-configuration-wrapper',
       'file' => 'media_mover_ui.theme.inc',
     ),
-    'media_mover_ui_configuration_view_header' => array (
-      'arguments' => array('configuration' => NULL),
+    'media_mover_ui_configuration_view_header' => array(
+      'variables' => array('configuration' => NULL),
       'file' => 'media_mover_ui.theme.inc',
     ),
   );
@@ -343,15 +348,15 @@ function media_mover_ui_menu_file_title_callback($file) {
  * Media Mover administration functions.
  *
  * Place holder to let other modules modify the form and add their own options.
- * Previously this used a hook, that has been depreciated.
+ * Previously this used a hook, that has been deprecated.
  *
  * @return array
  */
-function media_mover_ui_admin_settings() {
+function media_mover_ui_admin_settings($form, &$form_state) {
   $form = array();
   $form['admin'] = array(
     '#type' => 'markup',
-    '#value' => t('These settings set the default value for all configurations. Settings can be overridden on a per configuration basis by editing the configuration and changing the option values under the <em>advanced</em> option.')
+    '#markup' => t('These settings set the default value for all configurations. Settings can be overridden on a per configuration basis by editing the configuration and changing the option values under the <em>advanced</em> option.')
   );
   $form = system_settings_form($form);
   // Weight the buttons down so other modules can insert their elements
@@ -361,7 +366,7 @@ function media_mover_ui_admin_settings() {
 
 
 /**
- * Landing page for admin/config/media/media-mover/tools
+ * Landing page for MMA_CONFIG_PATH . '/tools'
  *
  * @return array, drupal form
  */
@@ -369,14 +374,14 @@ function media_mover_ui_admin_tools_form() {
   $form = array();
   $form['display'] = array(
     '#type' => 'markup',
-    '#value' => '<p>'. t('Sometimes it maybe necessary to reset
+    '#markup' => '<p>' . t('Sometimes it maybe necessary to reset
       the steps and configurations that are defined by modules.
-      You can %link.', array('%link' => l(t('reset them here'), 'admin/build/media_mover/tools/update')))
+      You can !link.', array('!link' => l(t('reset them here'), MMA_CONFIG_PATH . '/tools/update')))
   );
-
+//@todo FIXME: 1. MMA_CONFIG_PATH . '/tools/update' is not a valid path! (no entry in hook_menu()) 2. below code is incomplete.
   $links = array(
-    l(t('Clear Media Mover configuration cache'), 'admin/build/media_mover/tools/cache/clear/configurations'),
-    l(t('Clear Media Mover file cache'), 'admin/build/media_mover/tools/cache/clear/files')
+    l(t('Clear Media Mover configuration cache'), MMA_CONFIG_PATH . '/tools/cache/clear/configurations'),
+    l(t('Clear Media Mover file cache'), MMA_CONFIG_PATH . '/tools/cache/clear/files')
   );
   $form['markup'] = array(
 
@@ -392,7 +397,8 @@ function media_mover_ui_update_defaults() {
   media_mover_api_disable();
   media_mover_api_enable();
   drupal_set_message(t('Step and configurations defined by modules have been reset'));
-  drupal_goto('admin/build/media_mover/tools/media_mover_api');
+  drupal_goto(MMA_CONFIG_PATH . '/tools/media_mover_api');
+//@todo FIXME: MMA_CONFIG_PATH . '/tools/media_mover_api' is not a valid path! (no entry in hook_menu())
 }
 
 
@@ -416,20 +422,20 @@ function media_mover_ui_steps_all() {
     // Get a list of each configuration that uses this step
     $configurations = media_mover_api_step_configurations($sid);
     foreach ($configurations as $configuration) {
-      $list .= l($configuration->name, 'admin/build/media_mover/configuration/' . $configuration->cid) . '</br>';
+      $list .= l($configuration->name, MMA_CONFIG_PATH . '/configuration/' . $configuration->cid) . '</br>';
     }
     */
 
     $row = array(
-      l($step->name, 'admin/build/media_mover/steps/view/' . $step->sid),
-      l(t('Edit'), 'admin/build/media_mover/steps/edit/' . $step->sid),
-      l(t('Clone'), 'admin/build/media_mover/steps/clone/' . $step->sid),
-      l(t('Delete'), 'admin/build/media_mover/steps/delete/' . $step->sid),
+      l($step->name, MMA_CONFIG_PATH . '/steps/view/' . $step->sid),
+      l(t('Edit'), MMA_CONFIG_PATH . '/steps/edit/' . $step->sid),
+      l(t('Clone'), MMA_CONFIG_PATH . '/steps/clone/' . $step->sid),
+      l(t('Delete'), MMA_CONFIG_PATH . '/steps/delete/' . $step->sid),
     );
     $rows[] = $row;
   }
 
-  return theme('table', $header, $rows);
+  return theme('table', array('header' => $header, 'rows' => $rows));
 }
 
 
@@ -450,8 +456,8 @@ function media_mover_ui_steps_all() {
  * @return array drupal form
  */
 function media_mover_ui_config_edit_form($form, &$form_state, $configuration = NULL) {
-  drupal_add_css(drupal_get_path('module', 'media_mover_ui') .'/media_mover_ui.css');
-  drupal_add_js(drupal_get_path('module', 'media_mover_ui') . '/media_mover_ui.js', 'module');
+  drupal_add_css(drupal_get_path('module', 'media_mover_ui') . '/media_mover_ui.css');
+  drupal_add_js(drupal_get_path('module', 'media_mover_ui') . '/media_mover_ui.js');
 
   // If a configuration is already being created or edited
   if (! empty($form_state['storage']['configuration'])) {
@@ -463,7 +469,7 @@ function media_mover_ui_config_edit_form($form, &$form_state, $configuration = N
     $form_state['storage']['configuration'] = $configuration;
   }
   // When a configuration is being edited, store a copy into the form
-  elseif($configuration) {
+  elseif ($configuration) {
     $form_state['storage']['configuration'] = $configuration;
   }
 
@@ -648,15 +654,19 @@ function media_mover_ui_config_edit_form_submit($form, &$form_state) {
     // @TODO handle edit vs. add
     drupal_set_message(t('Media mover configuration %name !created.', array('%name' => $configuration->name, '!created' => $configuration->new ? 'created' : 'updated')));
     // Redirect the user to the configuration landing page
-   $form_state['redirect'] = 'admin/config/media/media-mover/configuration/'. $configuration->cid .'/view';
+    $form_state['redirect'] = MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/view';
 
- //   $form_state['storage']['configuration'] = $configuration;
- //  $form_state['rebuild'] = TRUE;
+//   $form_state['storage']['configuration'] = $configuration;
+//   $form_state['rebuild'] = TRUE;
   }
 }
 
 
-function media_mover_ui_fix_element_parents($key, &$element, $parents){
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function media_mover_ui_fix_element_parents($key, &$element, $parents) {
   if (! empty($element['#type'])) {
     if ($element['#type'] == 'fieldset') {
       $element['#parents'] = $parents;
@@ -733,14 +743,14 @@ function media_mover_ui_config_step_form($step, $step_order, $collapsed = FALSE)
     foreach (element_children($form['settings']) as $key) {
       // This will reparent all the form elements so they are under $form['configuration']['steps'][step_order]['settings'] regardless of
       // #tree being set to TRUE for fieldsets defined in the returned form.
-      media_mover_ui_fix_element_parents($key, $form['settings'][$key], array('configuration', 'steps', $step_order,'settings'));
+      media_mover_ui_fix_element_parents($key, $form['settings'][$key], array('configuration', 'steps', $step_order, 'settings'));
     }
   }
   else {
     $form['settings'] = array(
       '#type' => 'markup',
       '#weight' => -1,
-      '#value' => '<div>'. t('There are no settings for this action') .'</div>',
+      '#value' => '<div>' . t('There are no settings for this action') . '</div>',
     );
   }
 
@@ -759,7 +769,7 @@ function media_mover_ui_config_step_form($step, $step_order, $collapsed = FALSE)
  */
 function media_mover_ui_config_step_add(&$form, &$form_state) {
   // Get the configuration
- $configuration = $form_state['storage']['configuration'];
+  $configuration = $form_state['storage']['configuration'];
 
   // If this is the first step do not advance the step count.
   if ($configuration->step) {
@@ -781,10 +791,10 @@ function media_mover_ui_config_step_add(&$form, &$form_state) {
  * @param $cid is a configuration id
  * @return array drupal form
  */
-function media_mover_ui_config_empty_confirm($form_state, $configuration) {
+function media_mover_ui_config_empty_confirm($form, &$form_state, $configuration) {
   $form['markup'] = array(
     '#type' => 'markup',
-    '#value' => t('You are about to empty:<br /> %config_name <br /> %config_description <br /><br />'.
+    '#value' => t('You are about to empty:<br /> %config_name <br /> %config_description <br /><br />' .
       'This removes Media Mover\'s references to items created by this
       configuration and will delete any files created (unless you choose to not
       delete them). Doing this will take all of this configuration\'s media off
@@ -809,7 +819,7 @@ function media_mover_ui_config_empty_confirm($form_state, $configuration) {
   return confirm_form(
     $form,
     t('Are you sure you want to empty this configuration and remove references to its files?'),
-    'admin/build/media_mover',
+    MMA_CONFIG_PATH,
     t('This action cannot be undone.'),
     t('Empty'),
     t('Cancel'),
@@ -838,7 +848,7 @@ function media_mover_ui_config_empty_confirm_submit($form, &$form_state) {
       '!run' => l(t('run cron manually'), 'cron.php'))
     )
   );
-  $form_state['redirect'] = 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/view';
+  $form_state['redirect'] = MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/view';
 }
 
 
@@ -870,7 +880,7 @@ function media_mover_ui_config_delete_confirm($form, $form_state, $configuration
   return confirm_form(
     $form,
     t('Are you sure you want to delete this configuration?'),
-    'admin/build/media_mover/configuration/' . $configuration->cid . '/view',
+    MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/view',
     t('This action cannot be undone and will remove ALL files created by this configuration'),
     t('Delete'),
     t('Cancel'),
@@ -886,13 +896,14 @@ function media_mover_ui_config_delete_confirm_submit($form_id, &$form_state) {
   $configuration = $form_state['values']['configuration'];
   $configuration->delete();
   if (! empty($configuration->messages)) {
-    $content = theme('table', array(t('Type'), t('Message')), $configuration->messages);
-  } else {
+    $content = theme('table', array('header' => array(t('Type'), t('Message')), 'rows' => $configuration->messages));
+  }
+  else {
     $content = t('Deleted the configuration.');
   }
 
   drupal_set_message($content);
-  $form_state['redirect'] = 'admin/config/media/media-mover';
+  $form_state['redirect'] = MMA_CONFIG_PATH;
 }
 
 
@@ -960,7 +971,7 @@ function media_mover_ui_configurations_view() {
       // Build the configuration statistics
       $stats = array();
       // Get the total number of files for this config
-      $stats[] = l(t('Files: !count', array('!count' => $configuration->file_count())), 'admin/config/media/media-mover/configuration/'. $configuration->cid .'/files');
+      $stats[] = l(t('Files: !count', array('!count' => $configuration->file_count())), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/files');
       $stats[] = t('Errors: !count', array('!count' => $configuration->file_count(MMA_FILE_STATUS_ERROR)));
       // Get the in process file count
       $stats[] = t('Running: !count', array('!count' => $configuration->file_count(MMA_FILE_STATUS_LOCKED)));
@@ -984,7 +995,7 @@ function media_mover_ui_configurations_view() {
   // There are no configurations in the system
   else {
     return t('There are no configurations in the system. Please !create one.', array(
-      '!create' => l(t('create'), 'admin/config/media/media-mover/add'))
+      '!create' => l(t('create'), MMA_CONFIG_PATH . '/add'))
     );
   }
   return theme('media_mover_ui_configurations_list', array('configurations' => $output));
@@ -1007,14 +1018,14 @@ function media_mover_ui_configuration_view($configuration) {
 
   // Create the list of actions you can take with this configuration
   $links = array(
-    l(t('View files'), "admin/build/media_mover/configuration/$cid/files"),
-    l(t('Export configuration'), "admin/build/media_mover/export/". $cid),
-    l(t('Reset all step statuses'), "admin/build/media_mover/configuration/$cid/steps_reset"),
-    l(t('Purge files created by this configuration'), "admin/build/media_mover/configuration/$cid/empty"),
-    l(t('Delete configuration'), "admin/build/media_mover/configuration/$cid/delete"),
-    l(t('Clone configuration'), "admin/build/media_mover/configuration/$cid/clone"),
+    l(t('View files'), MMA_CONFIG_PATH . "/configuration/$cid/files"),
+    l(t('Export configuration'), MMA_CONFIG_PATH . "/export/" . $cid),
+    l(t('Reset all step statuses'), MMA_CONFIG_PATH . "/configuration/$cid/steps_reset"),
+    l(t('Purge files created by this configuration'), MMA_CONFIG_PATH . "/configuration/$cid/empty"),
+    l(t('Delete configuration'), MMA_CONFIG_PATH . "/configuration/$cid/delete"),
+    l(t('Clone configuration'), MMA_CONFIG_PATH . "/configuration/$cid/clone"),
   );
-  $ops = theme('item_list', $links);
+  $ops = theme('item_list', array('items' => $links));
 
   // Get a text name of the configuration status
   $configuration->status_name = media_mover_api_configuration_status($configuration->status);
@@ -1034,12 +1045,12 @@ function media_mover_ui_configuration_view($configuration) {
 
   $stats = array();
   // Get the file count
-  $stats[] = l($configuration->file_count(), "admin/build/media_mover/configuration/$cid/files");
-  $stats[] = l($configuration->file_count(MMA_FILE_STATUS_FINISHED), "admin/build/media_mover/configuration/$cid/files/" . MMA_FILE_STATUS_FINISHED);
+  $stats[] = l($configuration->file_count(), MMA_CONFIG_PATH . "/configuration/$cid/files");
+  $stats[] = l($configuration->file_count(MMA_FILE_STATUS_FINISHED), MMA_CONFIG_PATH . "/configuration/$cid/files/" . MMA_FILE_STATUS_FINISHED);
+  // Get the in process file count
+  $stats[] = l(t('!count being processed', array('!count' => $configuration->file_count(MMA_FILE_STATUS_LOCKED))), MMA_CONFIG_PATH . "/configuration/$cid/files/" . MMA_FILE_STATUS_LOCKED);
   // Get the in process file count
-  $stats[] = l(t('!count being processed', array('!count' => $configuration->file_count(MMA_FILE_STATUS_LOCKED))), "admin/build/media_mover/configuration/$cid/files/" . MMA_FILE_STATUS_LOCKED);
-   // Get the in process file count
-  $stats[] = l(t('!count errors', array('!count' => $configuration->file_count(MMA_FILE_STATUS_ERROR))), "admin/build/media_mover/configuration/$cid/files/" . MMA_FILE_STATUS_ERROR);
+  $stats[] = l(t('!count errors', array('!count' => $configuration->file_count(MMA_FILE_STATUS_ERROR))), MMA_CONFIG_PATH . "/configuration/$cid/files/" . MMA_FILE_STATUS_ERROR);
 
   $header = array(t('Total files'), t('Completed'), t('In process'), t('Error'));
   $content .= theme('table', array('header' => $header, 'rows' => array($stats)));
@@ -1065,7 +1076,7 @@ function media_mover_ui_configuration_view($configuration) {
  */
 function media_mover_ui_configuration_run($configuration) {
   $content = '';
-  set_time_limit(0);
+  drupal_set_time_limit(0);
   drupal_add_css(drupal_get_path('module', 'media_mover_ui') . '/media_mover_ui.css');
 
   $configuration->run();
@@ -1109,7 +1120,7 @@ function media_mover_ui_configuration_status_change($configuration, $status) {
     case MMA_CONFIG_STATUS_ENABLED:
     case MMA_CONFIG_STATUS_DISABLED:
       media_mover_api_configuration_status_set($status, $configuration);
-    break;
+      break;
 
     // Reverting is a special case
     case 'revert':
@@ -1117,10 +1128,10 @@ function media_mover_ui_configuration_status_change($configuration, $status) {
       if (media_mover_api_configuration_code_revert($configuration)) {
         drupal_set_message(t('Configuration %name has been reverted.', array('!name' => $configuration->name)));
         // Return user to referrer
-        drupal_goto(referer_uri());
+        drupal_goto($_SERVER['HTTP_REFERER']);
       }
       // Error condition
-    break;
+      break;
   }
 
   // Save it
@@ -1139,7 +1150,7 @@ function media_mover_ui_configuration_status_change($configuration, $status) {
 function media_mover_ui_config_steps_reset($configuration) {
   $configuration->steps_reset();
   drupal_set_message(t('All steps statuses have been reset'));
-  drupal_goto('admin/build/media_mover/configuration/' . $configuration->cid . '/view');
+  drupal_goto(MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/view');
 }
 
 
@@ -1166,7 +1177,7 @@ function media_mover_ui_config_clone($configuration) {
   }
   $clone->save();
   drupal_set_message(t('Configuration has been cloned'));
-  drupal_goto('admin/build/media_mover/configuration/' . $clone->cid . '/edit');
+  drupal_goto(MMA_CONFIG_PATH . '/configuration/' . $clone->cid . '/edit');
 }
 
 
@@ -1184,7 +1195,7 @@ function media_mover_ui_config_clone($configuration) {
  */
 function media_mover_ui_files_list($configuration = FALSE, $status = FALSE) {
   $rows = array();
-  drupal_add_css(drupal_get_path('module', 'media_mover_ui') .'/media_mover_ui.css');
+  drupal_add_css(drupal_get_path('module', 'media_mover_ui') . '/media_mover_ui.css');
 
   $query = db_select('media_mover_files', 'mmf')
     ->extend('PagerDefault')
@@ -1201,13 +1212,13 @@ function media_mover_ui_files_list($configuration = FALSE, $status = FALSE) {
 
   foreach ($results as $result) {
     $rows[] = array(
-      l($result->mmfid, 'admin/config/media/media-mover/file/' . $result->mmfid . '/edit'),
+      l($result->mmfid, MMA_CONFIG_PATH . '/file/' . $result->mmfid . '/edit'),
       $result->nid ? l($result->nid, 'node/' . $result->nid) : t('NA'),
       $result->source_uri,
       $result->uri,
       $configuration->steps[$result->step_order]->build['description'],
       $result->status,
-      l($configuration->name, 'admin/config/media/media-mover/' . $configuration->cid),
+      l($configuration->name, MMA_CONFIG_PATH . '/' . $configuration->cid),
       format_date($result->date),
     );
   }
@@ -1279,7 +1290,7 @@ function media_mover_ui_edit_file_form($form, &$form_state, $file) {
     $header = array(array('data' => t('Configuration: %name', array('%name' => $configuration->name)), 'colspan' => 2));
     $form['title'] = array(
       '#type' => 'markup',
-      '#value' => theme('table', $header, $rows)
+      '#value' => theme('table', array('header' => $header, 'rows' => $rows))
     );
   }
 
@@ -1341,7 +1352,7 @@ function media_mover_ui_edit_file_form_submit($form, &$form_state) {
   }
   $file->save();
   drupal_set_message(t('Media mover file ID: !id was updated.', array('!id' => $form_state['values']['mmfid'])));
-  $form_state['redirect'] = 'admin/config/media/media-mover/configuration/' . $file->cid . '/files';
+  $form_state['redirect'] = MMA_CONFIG_PATH . '/configuration/' . $file->cid . '/files';
 }
 
 
@@ -1354,7 +1365,7 @@ function media_mover_ui_edit_file_form_submit($form, &$form_state) {
  */
 function media_mover_ui_edit_file_form_delete_submit($form, &$form_state, $file) {
   // redirect to the delete confirm
-  $form_state['redirect'] = 'admin/config/media/media-mover/file/' . $form_state['values']['mmfid'] . '/delete';
+  $form_state['redirect'] = MMA_CONFIG_PATH . '/file/' . $form_state['values']['mmfid'] . '/delete';
 }
 
 
@@ -1364,7 +1375,7 @@ function media_mover_ui_edit_file_form_delete_submit($form, &$form_state, $file)
  * @param int $mmfid is a media mover field id
  * @return array drupal confirm
  */
-function media_mover_ui_file_delete_confirm_form($form_state, $mmfid) {
+function media_mover_ui_file_delete_confirm_form($form, &$form_state, $mmfid) {
   $form['display_data'] = array(
     '#type' => 'markup',
     '#value' => t('You are about to delete file id#: %fid', array('%fid' => $mmfid)),
@@ -1375,7 +1386,7 @@ function media_mover_ui_file_delete_confirm_form($form_state, $mmfid) {
     );
   return confirm_form($form,
       t('Are you sure you want to delete this file?'),
-      'admin/build/media_mover/files',
+      MMA_CONFIG_PATH . '/files',
       t('This action cannot be undone.'),
       t('Delete'),
       t('Cancel')
@@ -1394,7 +1405,7 @@ function media_mover_ui_file_delete_confirm_form_submit($form, &$form_state) {
   $file = media_mover_api_file_load($form['mmfid']['#value']);
   $file->delete();
   drupal_set_message(t('Deleted the file.'));
-  $form_state['redirect'] = 'admin/config/media/media-mover/configuration/' . $file->cid . '/files';
+  $form_state['redirect'] = MMA_CONFIG_PATH . '/configuration/' . $file->cid . '/files';
 }
 
 
@@ -1442,35 +1453,35 @@ function media_mover_ui_form_element_values_extract($form_part, $values) {
  * This function does not exist in php versions less than php 5.3 See:
  * http://www.php.net/manual/en/function.array-replace-recursive.php
  */
- if (! function_exists('array_replace_recursive')) {
-   function array_replace_recursive($array, $array1) {
-     function recurse($array, $array1) {
-       foreach ($array1 as $key => $value) {
-         // create new key in $array, if it is empty or not an array
-         if (! isset($array[$key]) || (isset($array[$key]) && ! is_array($array[$key]))) {
-           $array[$key] = array();
-         }
-
-         // Overwrite the value in the base array
-         if (is_array($value)) {
-           $value = recurse($array[$key], $value);
-         }
-         $array[$key] = $value;
-       }
-       return $array;
-     }
-
-     // Handle the arguments, merge one by one
-     $args = func_get_args();
-     $array = $args[0];
-     if (! is_array($array)) {
-       return $array;
-     }
-     for ($i = 1; $i < count($args); $i++) {
-       if (is_array($args[$i])) {
-         $array = recurse($array, $args[$i]);
-       }
-     }
-     return $array;
-   }
- }
\ No newline at end of file
+if (! function_exists('array_replace_recursive')) {
+  function array_replace_recursive($array, $array1) {
+    function recurse($array, $array1) {
+      foreach ($array1 as $key => $value) {
+        // create new key in $array, if it is empty or not an array
+        if (! isset($array[$key]) || (isset($array[$key]) && ! is_array($array[$key]))) {
+          $array[$key] = array();
+        }
+
+        // Overwrite the value in the base array
+        if (is_array($value)) {
+          $value = recurse($array[$key], $value);
+        }
+        $array[$key] = $value;
+      }
+      return $array;
+    }
+
+    // Handle the arguments, merge one by one
+    $args = func_get_args();
+    $array = $args[0];
+    if (! is_array($array)) {
+      return $array;
+    }
+    for ($i = 1; $i < count($args); $i++) {
+      if (is_array($args[$i])) {
+        $array = recurse($array, $args[$i]);
+      }
+    }
+    return $array;
+  }
+}
diff --git a/media_mover_ui/media_mover_ui.theme.inc b/media_mover_ui/media_mover_ui.theme.inc
index 012ec3d..6a3032a 100644
--- a/media_mover_ui/media_mover_ui.theme.inc
+++ b/media_mover_ui/media_mover_ui.theme.inc
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  * Theme functions for the Media Mover UI
@@ -12,11 +10,12 @@
  * @param $element
  * @return unknown_type
  */
-function theme_media_mover_ui_configuration_action_select($element) {
+function theme_media_mover_ui_configuration_action_select($variables) {
+  $element = $variables['element'];
   foreach (element_children($element) as $item) {
     if (! element_property($element[$item])) {
       $html[] = '<div style="float: left;">';
-      $html[] = drupal_render($element[$item]);
+      $html[] = drupal_render_children($element[$item]);
       $html[] = '</div>';
     }
   }
@@ -32,34 +31,35 @@ function theme_media_mover_ui_configuration_action_select($element) {
  *   Object, media mover configuration
  * @return string
  */
-function theme_media_mover_ui_configuration_view_header($vars) {
-  if ($configuration = $vars['configuration']) {
+function theme_media_mover_ui_configuration_view_header($variables) {
+  $configuration = $variables['configuration'];
+  if ($configuration) {
     // Build the operations that can be done on each step
     $ops = array();
-    $ops[] = l(t('View'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/view');
+    $ops[] = l(t('View'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/view');
     switch ($configuration->status) {
       case MMA_CONFIG_STATUS_ENABLED:
-        $ops[] = l(t('Edit'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/edit');
-        $ops[] = l(t('Disable'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
-        $ops[] = l(t('Run'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/run');
-      break;
+        $ops[] = l(t('Edit'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/edit');
+        $ops[] = l(t('Disable'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
+        $ops[] = l(t('Run'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/run');
+        break;
       case MMA_CONFIG_STATUS_OVERRIDDEN:
-        $ops[] = l(t('Edit'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/edit');
-        $ops[] = l(t('Revert'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/revert');
-        $ops[] = l(t('Disable'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
-        $ops[] = l(t('Run'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/run');
-      break;
+        $ops[] = l(t('Edit'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/edit');
+        $ops[] = l(t('Revert'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/revert');
+        $ops[] = l(t('Disable'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
+        $ops[] = l(t('Run'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/run');
+        break;
       case MMA_CONFIG_STATUS_DEFAULT:
-        $ops[] = l(t('Override'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/edit');
-        $ops[] = l(t('Disable'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
-        $ops[] = l(t('Run'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/run');
-      break;
+        $ops[] = l(t('Override'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/edit');
+        $ops[] = l(t('Disable'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_DISABLED);
+        $ops[] = l(t('Run'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/run');
+        break;
       case MMA_CONFIG_STATUS_DISABLED:
-        $ops[] = l(t('Enable'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_ENABLED);
-      break;
+        $ops[] = l(t('Enable'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/status/' . MMA_CONFIG_STATUS_ENABLED);
+        break;
     }
-    $ops[] = l(t('Files'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/files');
-    $ops[] = l(t('Delete'), 'admin/config/media/media-mover/configuration/' . $configuration->cid . '/delete');
+    $ops[] = l(t('Files'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/files');
+    $ops[] = l(t('Delete'), MMA_CONFIG_PATH . '/configuration/' . $configuration->cid . '/delete');
     return implode(' | ', $ops);
   }
 }
\ No newline at end of file
diff --git a/media_mover_ui/theme/media-mover-configuration-wrapper.tpl.php b/media_mover_ui/theme/media-mover-configuration-wrapper.tpl.php
index bf7c2aa..79fa1d7 100644
--- a/media_mover_ui/theme/media-mover-configuration-wrapper.tpl.php
+++ b/media_mover_ui/theme/media-mover-configuration-wrapper.tpl.php
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  * Provides a wrapper for configuration display
diff --git a/media_mover_ui/theme/media-mover-configuration.tpl.php b/media_mover_ui/theme/media-mover-configuration.tpl.php
index 0926e41..93771aa 100644
--- a/media_mover_ui/theme/media-mover-configuration.tpl.php
+++ b/media_mover_ui/theme/media-mover-configuration.tpl.php
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  *
diff --git a/media_mover_ui/theme/media-mover-configurations.tpl.php b/media_mover_ui/theme/media-mover-configurations.tpl.php
index 527e7a6..11d3f49 100644
--- a/media_mover_ui/theme/media-mover-configurations.tpl.php
+++ b/media_mover_ui/theme/media-mover-configurations.tpl.php
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 /**
  * @file
  *
diff --git a/tests/media_mover_api.test b/tests/media_mover_api.test
index c789ea6..0831025 100644
--- a/tests/media_mover_api.test
+++ b/tests/media_mover_api.test
@@ -75,7 +75,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
    * Tests the creation and saving of a media mover creation object
    */
   function testMediaMoverConfiguration() {
-    $id = time() + rand();
+    $id = REQUEST_TIME + rand();
     $configuration = $this->newMediaMoverTestConfiguration($id);
 
     // Save a copy so that we can test against the API
@@ -106,11 +106,11 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
    * Test the media mover step api
    */
   function testMediaMoverStep() {
-    $id = time() + rand();
+    $id = REQUEST_TIME + rand();
     $configuration = $this->newMediaMoverTestConfiguration($id);
     $configuration->save();
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $step = $this->newMediaMoverTestStep($sid);
     $step->cid = $configuration->cid;
 
@@ -125,11 +125,11 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     unset($step);
     $step = new media_mover_step($sid);
 
-    $this->assertTrue($step->name == $original->name ? TRUE: FALSE,
+    $this->assertTrue($step->name == $original->name ? TRUE : FALSE,
       'Step names are saved correctly to the database.');
-    $this->assertTrue($step->module == $original->module ? TRUE: FALSE,
+    $this->assertTrue($step->module == $original->module ? TRUE : FALSE,
       'Steps save the correct module.');
-    $this->assertTrue($step->action_id == $original->action_id ? TRUE: FALSE,
+    $this->assertTrue($step->action_id == $original->action_id ? TRUE : FALSE,
       'Steps save the correct action id.');
 
     // Add the updated step to the configuration
@@ -167,7 +167,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     $this->assertTrue(! empty($file->data['filesize']), 'Filesize is stored to the file settings');
 
     // Stub a step out for testing data save
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $step = $this->newMediaMoverTestStep($sid);
     $file->update_uri(TRUE, $step);
     $data = $file->data_get('steps');
@@ -197,10 +197,10 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
   function testMediaMoverConfigurationRun() {
     $test_filepath = drupal_get_path('module', 'mm_test') . '/test_files/test_file.txt';
 
-    $cid = time() + rand();
+    $cid = REQUEST_TIME + rand();
     $configuration = $this->newMediaMoverTestConfiguration($cid);
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $select = $this->newMediaMoverTestStep($sid);
     $select->cid = $configuration->cid;
     $select->module = 'mm_dir';
@@ -211,7 +211,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     );
     $configuration->steps[] = $select;
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $store = $this->newMediaMoverTestStep($sid);
     $store->cid = $configuration->cid;
     $store->module = 'mm_dir';
@@ -258,10 +258,10 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
    */
   function testMediaMoverConfigurationCron() {
     $test_filepath = drupal_get_path('module', 'mm_test') . '/test_files/test_file.txt';
-    $cid = time() + rand();
+    $cid = REQUEST_TIME + rand();
     $configuration = $this->newMediaMoverTestConfiguration($cid);
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $select = $this->newMediaMoverTestStep($sid);
     $select->cid = $configuration->cid;
     $select->module = 'mm_dir';
@@ -272,7 +272,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     );
     $configuration->steps[] = $select;
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $store = $this->newMediaMoverTestStep($sid);
     $store->cid = $configuration->cid;
     $store->module = 'mm_dir';
@@ -280,7 +280,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     $store->settings = array('path' => file_directory_temp());
     $configuration->steps[] = $store;
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $store = $this->newMediaMoverTestStep($sid);
     $store->cid = $configuration->cid;
     $store->module = 'mm_dir';
@@ -324,10 +324,10 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
    */
   function testMediaMoverConfigurationCFileStatus() {
     $test_filepath = drupal_get_path('module', 'mm_test') . '/test_files/test_file.txt';
-    $cid = time() + rand();
+    $cid = REQUEST_TIME + rand();
     $configuration = $this->newMediaMoverTestConfiguration($cid);
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $select = $this->newMediaMoverTestStep($sid);
     $select->cid = $configuration->cid;
     $select->module = 'mm_dir';
@@ -338,7 +338,7 @@ class MediaMoverApiTest extends MediaMoverTestHelper {
     );
     $configuration->steps[] = $select;
 
-    $sid = time() + rand();
+    $sid = REQUEST_TIME + rand();
     $store = $this->newMediaMoverTestStep($sid);
     $store->cid = $configuration->cid;
     $store->module = 'mm_test';
diff --git a/tests/mm_test.module b/tests/mm_test.module
index 09edf5e..4732b37 100644
--- a/tests/mm_test.module
+++ b/tests/mm_test.module
@@ -38,7 +38,7 @@ function mm_test_cron() {
 
 
 /**
- * Implementation of hook_cron_queue_info().
+ * Implements hook_cron_queue_info().
  */
 function mm_test_cron_queue_info() {
   $queues['mm_test_custom_queue_first'] = array(
@@ -54,7 +54,7 @@ function mm_test_cron_queue_info() {
 
 
 /**
- * Implementation of hook_media_mover().
+ * Implements hook_media_mover().
  *
  * This is for testing purposes only.
  *
