diff --git a/uc_fedex.module b/uc_fedex.module
index ffcb510..d0e47e7 100644
--- a/uc_fedex.module
+++ b/uc_fedex.module
@@ -13,7 +13,7 @@
 
 
 /** Maximum shipping weight for FedEx (non-Freight services) */
-define('FEDEX_PACKAGE_WEIGHT_LIMIT_LBS', 150.0);  // 150lbs
+define('PACKAGE_WEIGHT_LIMIT_LBS', 150.0);  // 150lbs
 
 // Set to 0 to disable caching of SOAP WSDL when developing your WSDL
 ini_set("soap.wsdl_cache_enabled", "1");
@@ -31,7 +31,7 @@ ini_set("soap.wsdl_cache_enabled", "1");
 function uc_fedex_menu() {
   $items = array();
 
-  $items['admin/store/settings/quotes/settings/fedex'] = array(
+  $items['admin/store/settings/quotes/methods/fedex'] = array(
     'title'            => 'FedEx',
     'page callback'    => 'drupal_get_form',
     'page arguments'   => array('uc_fedex_admin_settings'),
@@ -62,8 +62,14 @@ function uc_fedex_menu() {
 
 /**
  * Implements hook_init().
+ *
+ * Used to load module includes and CSS.  This is the wrong place to
+ * add CSS because the CSS will be included on every page, not just on
+ * the pages where it is needed.  However, this is currently the
+ * Ubercart-recommended place for adding shipping quotes CSS.
  */
 function uc_fedex_init() {
+  drupal_add_css(drupal_get_path('module', 'uc_fedex') .'/uc_fedex.css');
 
 // Can we conditionally load the address validation code based on
 // variable_get('uc_fedex_address_validation', FALSE) ?
@@ -77,23 +83,27 @@ function uc_fedex_init() {
  * Implements hook_cron().
  *
  * Deletes FedEx shipping labels from the file system automatically
- * on a periodic basis.  Cron must be enabled for automatic deletion.
- * Default lifetime is 1 week (604800 seconds).
+ * on a periodic basis.  Default period is 1 week.
  */
 function uc_fedex_cron() {
-  $cutoff = REQUEST_TIME - variable_get('uc_fedex_label_lifetime', 604800);
-  if ($cutoff == REQUEST_TIME) {
+  $current_time = time();
+  $cutoff = $current_time - variable_get('uc_fedex_label_lifetime', 604800);
+  if ($cutoff == $current_time) {
     // Label lifetime is set to 0, meaning never delete
     return;
   }
 
-  // Loop over label files in public://fedex_labels and test
-  // creation date against 'uc_fedex_label_lifetime'
-  $files = file_scan_directory('public://fedex_labels', '/^label-/');
-  foreach ($files as $file) {
-    if ($cutoff > filectime($file->uri)) {
-      drupal_unlink($file->uri);
-      watchdog('uc_fedex', 'Removed uc_fedex label file @file.', array('@file' => $file->uri), WATCHDOG_NOTICE);
+  $path = file_create_path('fedex_labels');
+  if (is_dir($path)) {
+    $files = array_diff(scandir($path), array('.', '..'));
+    if ($files) {
+      // Loop over label files in sites/default/files/fedex_labels
+      // and test creation date against 'uc_fedex_label_lifetime'
+      foreach ($files as $file) {
+        if ($cutoff > filectime($path .'/'. $file)) {
+          unlink($path .'/'. $file);
+        }
+      }
     }
   }
 }
@@ -106,31 +116,103 @@ function uc_fedex_theme() {
   return array(
     'uc_fedex_option_label' => array(
       'file'      => 'uc_fedex.module',
-      'variables' => array(
-        'service'  => NULL,
+      'arguments' => array(
+        'product'  => NULL,
         'packages' => NULL,
       ),
     ),
     'uc_fedex_confirm_shipment' => array(
-      'render element' => 'form',
-      'file'           => 'uc_fedex.ship.inc',
+      'file'      => 'uc_fedex.ship.inc',
+      'arguments' => array('form' => NULL),
     ),
   );
 }
 
 
 /******************************************************************************
+ * Conditional Actions Hooks                                                  *
+ ******************************************************************************/
+
+
+/**
+ * Implements hook_ca_predicate().
+ *
+ * Connect the FedEx quote Action and Event.
+ */
+function uc_fedex_ca_predicate() {
+  $enabled = variable_get('uc_quote_enabled', array() + array(
+    'fedex_ground'  => FALSE,
+    'fedex'         => FALSE,
+    'fedex_freight' => FALSE,
+  ));
+
+  $predicates = array(
+    'uc_fedex_get_ground_quote' => array(
+      '#title'   => t('Shipping quote from FedEx Ground'),
+      '#trigger' => 'get_quote_from_fedex_ground',
+      '#class'   => 'uc_fedex',
+      '#status'  => $enabled['fedex_ground'],
+      '#actions' => array(
+        array(
+          '#name'         => 'uc_quote_action_get_quote',
+          '#title'        => t('Fetch a shipping quote'),
+          '#argument_map' => array(
+            'order'  => 'order',
+            'method' => 'method',
+          ),
+        ),
+      ),
+    ),
+    'uc_fedex_get_quote' => array(
+      '#title'   => t('Shipping quote from FedEx'),
+      '#trigger' => 'get_quote_from_fedex',
+      '#class'   => 'uc_fedex',
+      '#status'  => $enabled['fedex'],
+      '#actions' => array(
+        array(
+          '#name'         => 'uc_quote_action_get_quote',
+          '#title'        => t('Fetch a shipping quote'),
+          '#argument_map' => array(
+            'order'  => 'order',
+            'method' => 'method',
+          ),
+        ),
+      ),
+    ),
+    'uc_fedex_get_freight_quote' => array(
+      '#title'   => t('Shipping quote from FedEx Freight'),
+      '#trigger' => 'get_quote_from_fedex_freight',
+      '#class'   => 'uc_fedex',
+      '#status'  => $enabled['fedex_freight'],
+      '#actions' => array(
+        array(
+          '#name'         => 'uc_quote_action_get_quote',
+          '#title'        => t('Fetch a shipping quote'),
+          '#argument_map' => array(
+            'order'  => 'order',
+            'method' => 'method',
+          ),
+        ),
+      ),
+    ),
+  );
+
+  return $predicates;
+}
+
+
+/******************************************************************************
  * Ubercart Hooks                                                             *
  ******************************************************************************/
 
 
 /**
- * Implements Ubercart's hook_uc_shipping_type().
+ * Implements Ubercart's hook_shipping_type().
  *
  * @return
  *   Array of package types for FedEx shipping method.
  */
-function uc_fedex_uc_shipping_type() {
+function uc_fedex_shipping_type() {
   $weight = variable_get('uc_quote_type_weight', array('small_package' => 0));
 
   $types = array(
@@ -146,12 +228,12 @@ function uc_fedex_uc_shipping_type() {
 
 
 /**
- * Implements Ubercart's hook_uc_shipping_method().
+ * Implements Ubercart's hook_shipping_method().
  *
  * @return
  *   Array of FedEx shipping services.
  */
-function uc_fedex_uc_shipping_method() {
+function uc_fedex_shipping_method() {
   $enabled = variable_get('uc_quote_enabled', array()) + array(
     'fedex_ground'  => FALSE,
     'fedex'         => FALSE,
@@ -162,64 +244,55 @@ function uc_fedex_uc_shipping_method() {
     'fedex'         => 1,
     'fedex_freight' => 2,
   );
-  $operations = array(
-    'configure' => array(
-      'title' => t('configure'),
-      'href' => 'admin/store/settings/quotes/settings/fedex',
-    ),
-  );
 
   $methods = array(
     'fedex_ground' => array(
-      'id'         => 'fedex_ground',
-      'module'     => 'uc_fedex',
-      'title'      => t('FedEx (Ground)'),
-      'operations' => $operations,
-      'quote'      => array(
+      'id'      => 'fedex_ground',
+      'module'  => 'uc_fedex',
+      'title'   => t('FedEx (Ground)'),
+      'quote'   => array(
         'type'         => 'small_package',
         'callback'     => 'uc_fedex_quote',
         'accessorials' => _uc_fedex_ground_services(),
       ),
-      'ship'       => array(
+      'ship'    => array(
         'type'      => 'small_package',
         'callback'  => 'uc_fedex_fulfill_order',
         'file'      => 'uc_fedex.ship.inc',
         'pkg_types' => _uc_fedex_package_types(),
       ),
-      'enabled'    => $enabled['fedex_ground'],
-      'weight'     => $weight['fedex_ground'],
+      'enabled' => $enabled['fedex_ground'],
+      'weight'  => $weight['fedex_ground'],
     ),
     'fedex' => array(
-      'id'         => 'fedex',
-      'module'     => 'uc_fedex',
-      'title'      => t('FedEx (Express)'),
-      'operations' => $operations,
-      'quote'      => array(
+      'id'      => 'fedex',
+      'module'  => 'uc_fedex',
+      'title'   => t('FedEx (Express)'),
+      'quote'   => array(
         'type'         => 'small_package',
         'callback'     => 'uc_fedex_quote',
         'accessorials' => _uc_fedex_express_services(),
       ),
-      'ship'       => array(
+      'ship'    => array(
         'type'      => 'small_package',
         'callback'  => 'uc_fedex_fulfill_order',
         'file'      => 'uc_fedex.ship.inc',
         'pkg_types' => _uc_fedex_package_types(),
       ),
-      'enabled'    => $enabled['fedex'],
-      'weight'     => $weight['fedex'],
+      'enabled' => $enabled['fedex'],
+      'weight'  => $weight['fedex'],
     ),
     'fedex_freight' => array(
-      'id'         => 'fedex_freight',
-      'module'     => 'uc_fedex',
-      'title'      => t('FedEx (Freight)'),
-      'operations' => $operations,
-      'quote'      => array(
+      'id'      => 'fedex_freight',
+      'module'  => 'uc_fedex',
+      'title'   => t('FedEx (Freight)'),
+      'quote'   => array(
         'type'         => 'small_package',
         'callback'     => 'uc_fedex_quote',
         'accessorials' => _uc_fedex_freight_services(),
       ),
-      'enabled'    => $enabled['fedex_freight'],
-      'weight'     => $weight['fedex_freight'],
+      'enabled' => $enabled['fedex_freight'],
+      'weight'  => $weight['fedex_freight'],
     ),
   );
 
@@ -228,7 +301,7 @@ function uc_fedex_uc_shipping_method() {
 
 
 /**
- * Implements Ubercart's hook_uc_store_status().
+ * Implements Ubercart's hook_store_status().
  *
  * Lets the administrator know if the FedEx account information has not been
  * filled out.
@@ -236,7 +309,7 @@ function uc_fedex_uc_shipping_method() {
  * @return
  *   Array of error or status messages from configuration of FedEx module.
  */
-function uc_fedex_uc_store_status() {
+function uc_fedex_store_status() {
   $messages = array();
   $key      = variable_get('uc_fedex_user_credential_key', 0);
   $password = variable_get('uc_fedex_user_credential_password', 0);
@@ -254,7 +327,7 @@ function uc_fedex_uc_store_status() {
     $messages[] = array(
       'status' => 'error',
       'title'  => t('FedEx Ship Manager'),
-      'desc'   => t('More information is needed to access FedEx Ship Manager. Please enter it !link.', array('!link' => l('here', 'admin/store/settings/quotes/settings/fedex'))),
+      'desc'   => t('More information is needed to access FedEx Ship Manager. Please enter it !link.', array('!link' => l('here', 'admin/store/settings/quotes/methods/fedex'))),
     );
   }
 
@@ -287,14 +360,18 @@ function uc_fedex_quote($products, $details, $method) {
   // The uc_quote AJAX query can fire before the customer has completely
   // filled out the destination address, so check to see whether the address
   // is complete. If not, abort.
+
   $destination = (object) $details;
-  if (empty($destination->zone)        ||
-      empty($destination->postal_code) ||
-      empty($destination->country)       ) {
-    // Skip this shipping method.
+  // The country code is required.
+  if (empty($destination->country)) {
     return array();
   }
 
+  // US requires zone and postal code.
+  if ($destination->country == 840 && (empty($destination->zone) || empty($destination->postal_code))) {
+     return array();
+   }
+
   // Assign products to one or more packages for quoting
   $packages = _uc_fedex_package_products($products);
 
@@ -307,9 +384,9 @@ function uc_fedex_quote($products, $details, $method) {
   }
 
   // Create and fill object with info needed about origin
-  $origin  = variable_get('uc_quote_store_default_address', new UcAddress());
-  $country = db_query("SELECT * FROM {uc_countries} WHERE country_id = :id", array(':id' => $origin->country));
-  $country_data = $country->fetchObject();
+  $origin  = variable_get('uc_quote_store_default_address', new stdClass());
+  $country = db_query("SELECT * FROM {uc_countries} WHERE country_id = %d", $origin->country);
+  $country_data = db_fetch_object($country);
   $origin->country_iso_code_2 = $country_data->country_iso_code_2;
 
   // Create and fill object with info needed about destination
@@ -318,8 +395,8 @@ function uc_fedex_quote($products, $details, $method) {
     $destination->country_iso_code_2 = $origin->country_iso_code_2;
   }
   else {
-    $country = db_query("SELECT * FROM {uc_countries} WHERE country_id = :id", array(':id' => $destination->country));
-    $country_data = $country->fetchObject();
+    $country = db_query("SELECT * FROM {uc_countries} WHERE country_id = %d", $destination->country);
+    $country_data = db_fetch_object($country);
     $destination->country_iso_code_2 = $country_data->country_iso_code_2;
   }
 
@@ -401,7 +478,7 @@ function uc_fedex_quote($products, $details, $method) {
       $quotes[$service] = array(
         'rate'         => $rate,
         'format'       => uc_currency_format($rate),
-        'option_label' => theme('uc_fedex_option_label', array('service' => $method['quote']['accessorials'][$service], 'packages' => $packages)),  // cart pane
+        'option_label' => theme('uc_fedex_option_label', $method['quote']['accessorials'][$service], $packages),  // cart pane
       );
     }
   }
@@ -439,8 +516,8 @@ function uc_fedex_rate_request($packages, $origin, $destination) {
   // Set up SOAP call.
   // Allow tracing so details of request can be retrieved for error logging
   $client = new SoapClient(drupal_get_path('module', 'uc_fedex')
-              . '/wsdl-' . variable_get('uc_fedex_server_role', 'testing')
-              . '/RateService_v8.wsdl', array('trace' => 1));
+              .'/wsdl-'. variable_get('uc_fedex_server_role', 'testing')
+              .'/RateService_v8.wsdl', array('trace' => 1));
 
   // FedEx user key and password filled in by user on admin form
   $request['WebAuthenticationDetail'] = array(
@@ -506,7 +583,7 @@ function uc_fedex_rate_request($packages, $origin, $destination) {
   // Drupal 6.x version of format_date() doesn't support 'c', so until
   // then we use date() directly.  date() doesn't take care of site
   // timezone, though.
-  //$request['RequestedShipment']['ShipTimestamp'] = format_date(REQUEST_TIME, 'custom', 'c');
+  //$request['RequestedShipment']['ShipTimestamp'] = format_date(time(), 'custom', 'c');
   $request['RequestedShipment']['ShipTimestamp'] = date('c');
 
   //
@@ -595,7 +672,7 @@ function uc_fedex_rate_request($packages, $origin, $destination) {
       drupal_set_message(t('Error in processing FedEx Shipping Quote transaction.'), 'error');
       foreach ($response->Notifications as $notification) {
         if (is_array($response->Notifications)) {
-          drupal_set_message($notification->Severity . ': ' .
+          drupal_set_message($notification->Severity .': '.
                              $notification->Message, 'error');
         }
         else {
@@ -606,7 +683,7 @@ function uc_fedex_rate_request($packages, $origin, $destination) {
     return $response;
   }
   catch (SoapFault $exception) {
-    drupal_set_message('<h2>Fault</h2><br /><b>Code:</b>' . $exception->faultcode . '<br /><b>String:</b>' . $exception->faultstring . '<br />', 'error');
+    drupal_set_message('<h2>Fault</h2><br /><b>Code:</b>'. $exception->faultcode .'<br /><b>String:</b>'. $exception->faultstring .'<br />', 'error');
     // what else needs to be done here if FedEx quote fails?  What to display
     // to customer?
   }
@@ -702,10 +779,10 @@ function _uc_fedex_package_products($products) {
   $packages = array();
 
   // Determine maximum weight of products we can put into one package
-  // while staying below FEDEX_PACKAGE_WEIGHT_LIMIT_LBS.  This number
+  // while staying below PACKAGE_WEIGHT_LIMIT_LBS.  This number
   // depends on the package weight markup set in the FedEx module
   // administration menu.
-  $products_max_weight = FEDEX_PACKAGE_WEIGHT_LIMIT_LBS;
+  $products_max_weight = PACKAGE_WEIGHT_LIMIT_LBS;
   $zero_markup = uc_fedex_weight_markup(0);
   if ($zero_markup == 0) {
     // Weight markup is a multiplier, because 0 * multiplier = 0
@@ -746,7 +823,7 @@ function _uc_fedex_package_products($products) {
       }
 
       // Loop over qty of each product
-      for ($item = 0; $item < $product->qty; $item++) {
+      for ($item=0; $item<$product->qty; $item++) {
         // Test to see if putting this item into the current package put us
         // over the weight limit
         if (($package->weight + $item_weight) < $products_max_weight) {
@@ -942,7 +1019,7 @@ function _uc_fedex_shipment_special_types() {
     'SATURDAY_DELIVERY'     => t('Saturday Delivery'),
     'SATURDAY_PICKUP'       => t('Saturday Pickup'),
     'THIRD_PARTY_CONSIGNEE' => t('FedEx International First'),
-    'WEEKDAY_DELIVERY'      => t('Weekday delivery'),
+    'WEEKDAY_DELIVERY'      => t('Weekday delivery '),
   );
 }
 
@@ -980,11 +1057,11 @@ function _uc_fedex_dropoff_types() {
 function print_request_response($client) {
   if (user_access('configure quotes') &&
       variable_get('uc_quote_display_debug', FALSE)) {
-    drupal_set_message('<h2>FedEx Transaction processed successfully.</h2>' .
-                       '<h3>Request: </h3><pre>' .
-                       check_plain($client->__getLastRequest())  . '</pre>' .
-                       '<h3>Response: </h3><pre>' .
-                       check_plain($client->__getLastResponse()) . '</pre>');
+    drupal_set_message('<h2>FedEx Transaction processed successfully.</h2>'.
+                       '<h3>Request: </h3><pre>'.
+                       check_plain($client->__getLastRequest())  .'</pre>'.
+                       '<h3>Response: </h3><pre>'.
+                       check_plain($client->__getLastResponse()) .'</pre>');
   }
 }
 
@@ -993,20 +1070,16 @@ function print_request_response($client) {
  * Theme function to format the FedEx service name and rate amount
  * line-item shown to the customer.
  *
- * @param $variables
- *   Associative array containing information needed to theme a quote.
- *   Contains two keys:
- *   - service: The FedEx service name.
- *   - packages: Package information.
+ * @param $service
+ *   The FedEx service name.
+ * @param $packages
+ *   Package information.
  *
  * @ingroup themeable
  */
-function theme_uc_fedex_option_label($variables) {
-  $service  = $variables['service'];
-  $packages = $variables['packages'];
-
+function theme_uc_fedex_option_label($service, $packages) {
   // Start with FedEx logo
-  $output  = '<img class="fedex-logo" src="' . base_path() . drupal_get_path('module', 'uc_fedex') . '/uc_fedex_logo.gif" alt="FedEx Logo" />'
+  $output  = '<img class="fedex-logo" src="'. base_path() . drupal_get_path('module', 'uc_fedex') .'/uc_fedex_logo.gif" alt="FedEx Logo" />'
 ;
 
   // Add FedEx service name, removing the first six characters
