diff --git a/mobile_tools.admin.inc b/mobile_tools.admin.inc
index 7f1b3b3..0f3b03c 100644
--- a/mobile_tools.admin.inc
+++ b/mobile_tools.admin.inc
@@ -7,10 +7,10 @@
 
  /**
  * Configuration form for the mobile device detection, redirection and notification
- * 
+ *
  * @return
- *   The configuration form   
- */ 
+ *   The configuration form
+ */
 function mobile_tools_configuration_form() {
   global $base_url;
   $form['mobile_tools_configuration'] = array(
@@ -19,7 +19,7 @@ function mobile_tools_configuration_form() {
     '#description' => 'Enter the mobile and desktop url for your site. If both urls are equal there will be no redirection, but only theme switching. Go to "theme switching" to configure the theme',
     '#collapsible' => TRUE,
   );
-  
+
   $form['mobile_tools_configuration']['mobile_tools_mobile_url'] = array(
     '#type' => 'textfield',
     '#title' => t('Mobile URL'),
@@ -33,14 +33,14 @@ function mobile_tools_configuration_form() {
     '#collapsible' => TRUE,
     '#default_value' => variable_get('mobile_tools_desktop_url', $base_url)
   );
-  
+
  $form['mobile_tools_redirection'] = array(
     '#type' => 'fieldset',
     '#title' => t('Redirection options'),
-    '#collapsible' => TRUE,  
+    '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-  
+
   $form['mobile_tools_redirection']['mobile_tools_redirect'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enable automatic redirection of the mobile user'),
@@ -49,28 +49,28 @@ function mobile_tools_configuration_form() {
     view the desktop version. In order to do so, append ?device=desktop to the URL. The module
     will set a cookie that remembers that the user does not want to be redirected. To undo, add ?device=auto',
   );
-  
+
   $form['mobile_tools_redirection']['mobile_tools_cookie_session'] = array (
     '#type' => 'textfield',
     '#title' => 'Redirection cookie    (seconds)',
     '#description' => t('This field is only used when using the "?device=" setting. This is the lifetime of the cookie that determines how long the session is remembered. Choose 0 for only the session.'),
     '#default_value' => variable_get('mobile_tools_cookie_session', 3600*24*30),
   );
-  
+
   $form['mobile_tools_redirection']['mobile_tools_redirect_exceptions_type'] = array(
   	'#type' => 'radios',
     '#title' => 'exception type',
     '#options' => array('not-redirect' => 'Do not redirect from the following pages', 'only-redirect' => 'Do only redirect from the following pages' ),
     '#default_value' => variable_get('mobile_tools_redirect_exceptions_type', 'not-redirect'),
   );
-  
+
   $form['mobile_tools_redirection']['mobile_tools_redirect_exceptions'] = array(
   	'#type' => 'textarea',
     '#title' => 'redirection exceptions',
     '#description' => t('Give the paths to pages that should not be redirected. Put each path on a separate line. The \'*\' character is a wildcard.'),
     '#default_value' => variable_get('mobile_tools_redirect_exceptions', ''),
   );
-  
+
   $form['mobile_tools_notification'] = array(
     '#type' => 'fieldset',
     '#title' => t('Mobile Tools block message options'),
@@ -90,8 +90,8 @@ function mobile_tools_configuration_form() {
     '#title' => t('On the desktops site'),
     '#rows' => 2,
     '#default_value' => variable_get('desktop_notification', DESKTOP_NOTIFICATION),
-  ); 
-   
+  );
+
    $form['build_mode'] = array(
     '#type' => 'fieldset',
     '#title' => t('Mobile Tools Build Mode'),
@@ -99,21 +99,21 @@ function mobile_tools_configuration_form() {
     '#collapsed' => TRUE,
     '#description' => t('Enable a Mobile Build mode'),
   );
-  
+
   $form['build_mode']['mobile_tools_enable_build_mode'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enable a Mobile Tools display mode'),
     '#default_value' => variable_get('mobile_tools_enable_build_mode', 0),
     '#description' => t('New build modes will be available in the Content Types configuration page (see Manage Display)'),
   );
-  
+
   $form['extra'] = array(
     '#type' => 'fieldset',
     '#title' => 'extra',
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-  
+
 
   $form['extra']['default_nodes_main_mobile'] = array(
       '#type' => 'select',
@@ -153,7 +153,7 @@ function mobile_tools_configuration_form() {
 function mobile_tools_configuration_form_validate($form, &$form_state) {
   $form_state['values']['mobile_tools_mobile_url'] = preg_replace('{/$}', '', $form_state['values']['mobile_tools_mobile_url']);
   $form_state['values']['mobile_tools_desktop_url'] = preg_replace('{/$}', '', $form_state['values']['mobile_tools_desktop_url']);
-  
+
   // Move to submit handler
   cache_clear_all('entity_info', 'cache', TRUE);
   variable_set('menu_rebuild_needed', TRUE);
@@ -162,29 +162,29 @@ function mobile_tools_configuration_form_validate($form, &$form_state) {
 
  /**
  * Configuration form for configuring the mobile context in the theming system
- */ 
+ */
 function mobile_tools_themes_configuration_form() {
   $themes = mobile_tools_list_theme_names();
   $prefix = '';
   $warning = '';
   if (count($themes) == 0) {
     $warning = '<div class="message error">You must enable themes in order to use theme switching</div>';
-  }   
+  }
 
   $form['mobile_tools_theme_configuration'] = array(
     '#type' => 'fieldset',
     '#title' => 'Theming configuration',
     '#collapsible' => TRUE,
-    '#description' => t('You can assign a variation of your current theme to all mobile users . this allows you to configure your theme 
+    '#description' => t('You can assign a variation of your current theme to all mobile users . this allows you to configure your theme
     specific for mobile users. See !url for more information on this configuration. In order to use this functionality
     you will have to manually create a second *.info file in your theme directory.', array('!url' => l('help', 'help'))),
     '#suffix' => t('If enabled, !configure the settings of your mobile theme and manage the !blocks layout', array('!configure' => l('configure', 'admin/appearance/list'), '!blocks' => l('blocks', 'admin/structure/block'))) .'<br>',
     '#prefix' => $warning,
    );
-    $form['mobile_tools_theme_configuration']['mobile-tools-theme-switch'] = array(
+    $form['mobile_tools_theme_configuration']['mobile_tools_theme_switch'] = array(
     '#type' => 'radios',
     '#title' => t('When do you want to switch themes'),
-    '#default_value' => variable_get('mobile-tools-theme-switch', 'mobile-tools-no-switch'),
+    '#default_value' => variable_get('mobile_tools_theme_switch', 'mobile-tools-no-switch'),
     '#options' =>   array('mobile-tools-no-switch' => 'No theme switch', 'mobile-tools-mobile-device' => 'Switch theme for a mobile device *', 'mobile-tools-mobile-url' => 'Switch theme based on the URL'),
     '#description' => 'Choose one of these methods. *This is not recommended since using 1 url for both mobile and desktop site disable the drupal caching.',
   );
@@ -202,14 +202,14 @@ function mobile_tools_themes_configuration_form() {
     '#type' => 'fieldset',
     '#title' => t('Additional mobile specific theming configuration')
   );
-  
+
   $form['mobile_tools_theme_configuration']['mobile_tools_additional_config']['mobile_tools_hide_address_bar'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically hide address bar in mobile theme (uses javascript and only work on javascript enabled devices)'),
    '#default_value' => variable_get('mobile_tools_hide_address_bar', 1),
    '#description' => t('Enabling this injects some line of javascript to hide the address bar when the page is loaded'),
   );
-  
+
   $form['mobile_tools_theme_configuration']['mobile_tools_additional_config']['mobile_tools_add_header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add Mobile Tools header'),
@@ -219,14 +219,14 @@ function mobile_tools_themes_configuration_form() {
 
    // for each group, checkbox and dropdown
    // Mobile
-   $mobile_groups = module_invoke(variable_get('mobile-tools-device-detection', 'mobile_tools'), 'device_groups');
-   $mobile_detection_module = variable_get('mobile-tools-device-detection', 'mobile_tools');
+   $mobile_groups = module_invoke(variable_get('mobile_tools_device_detection', 'mobile_tools'), 'device_groups');
+   $mobile_detection_module = variable_get('mobile_tools_device_detection', 'mobile_tools');
    foreach ($mobile_groups as $group => $group_title) {
       $form['mobile_tools_theme_configuration'][$mobile_detection_module . '_' . $group] = array(
         '#type' => 'fieldset',
         '#title' => $group_title,
         '#collapsible' => TRUE,
-        
+
       );
       $form['mobile_tools_theme_configuration'][$mobile_detection_module . '_' . $group][$mobile_detection_module . '_' . $group . '_enable'] = array(
         '#type' => 'checkbox',
@@ -241,14 +241,14 @@ function mobile_tools_themes_configuration_form() {
          '#options' => $themes,
          '#description' => t('Select your mobile theme. See <a href="">help</a> for information on the name'),
       );
-     } 
+     }
    }
    return system_settings_form($form);
 }
 
 /**
  * Function returning the available themes
- */ 
+ */
 function mobile_tools_list_theme_names() {
   global $conf;
   $themes = list_themes();
@@ -256,11 +256,11 @@ function mobile_tools_list_theme_names() {
   foreach ($themes as $key => $value ) {
     if ($value->status == 1 ) {
       $list[] = $key;
-    }    
+    }
   }
   if (count($list) == 0) {
     return array();
-  } 
+  }
   else {
     return array_combine($list, $list);
   }
@@ -268,31 +268,31 @@ function mobile_tools_list_theme_names() {
 
 /**
  * Helper function to return the configuration options
- */ 
+ */
 function mobile_tools_configuration_options($configuration) {
   switch ($configuration) {
     case 'device handling':
       $options = array(
-        'nothing' => t('Do nothing, just provide the $_SESSION[\'mobile_device\'] variable'), 
-        'redirect' => t('Automatic redirection to mobile or desktop site'), 
+        'nothing' => t('Do nothing, just provide the $_SESSION[\'mobile_device\'] variable'),
+        'redirect' => t('Automatic redirection to mobile or desktop site'),
       //  'notification' => t('Display a block notification with link to mobile site'),
       //  'theme-switch' => t('Switch the theme when a mobile user visits the site (only 1 url for both mobile and desktop url). Enable and configure the mobile theme !here', array('!here' => l('here', 'admin/settings/mobile-tools/themes'))),
       );
     break;
     case 'site type':
       $options =  array(
-        'mobile' => t('Only the mobile site'),  
-        'desktop' => t('only the deskop site'), 
+        'mobile' => t('Only the mobile site'),
+        'desktop' => t('only the deskop site'),
         'mobile-desktop' => t('for both mobile and desktop site'),
       );
     break;
-  }  
+  }
   return $options;
 }
 
 /**
  * Configuration of external modules
- *  
+ *
  */
 function mobile_tools_external_modules_configuration_form() {
   $form['mobile_tools_detection'] = array(
@@ -301,45 +301,45 @@ function mobile_tools_external_modules_configuration_form() {
     '#collapsible' => TRUE,
     '#description' => t('You can let other modules do the device detection or detect if your site is being mobilised.'),
   );
-  $form['mobile_tools_detection']['mobile-tools-device-detection'] = array(
+  $form['mobile_tools_detection']['mobile_tools_device_detection'] = array(
     '#type' => 'radios',
     '#title' => 'Device detection module',
-    '#default_value' => variable_get('mobile-tools-device-detection', 'mobile_tools'),
+    '#default_value' => variable_get('mobile_tools_device_detection', 'mobile_tools'),
     '#options' => _mobile_tools_external('device-detection'),
     '#description' => t('Choose which module is in charge for detecting if the visiting device is a mobile device. The Mobile Tools provides a standard implementation. You can also use other modules'),
   );
-  
+
   $device_capability =  _mobile_tools_external('device-capability');
   $mess = '';
   if (count($device_capability) == 0) {
     $mess = 'No device capability modules installed';
   }
-  $form['mobile_tools_detection']['mobile-tools-device-capabilities'] = array(
+  $form['mobile_tools_detection']['mobile_tools_device_capabilities'] = array(
     '#type' => 'radios',
     '#title' => 'Device capability detection',
-    '#default_value' => variable_get('mobile-tools-device-capabilities', 'wurfl'),
+    '#default_value' => variable_get('mobile_tools_device_capabilities', 'wurfl'),
     '#options' => $device_capability,
     '#prefix' => $mess,
     '#description' => t('The mobile tools module gives an abstract api in order to get capabilities of the mobile devices. These capability can be fetched by calling mobile_tools_devicecapability($capability). Capability can be for example "is_wireless_device". A full range of parameters can be found on !wurfl you need at least one capability module (like !wurfl2) to use this functionality', array('!wurfl' => l('http://wurfl.sourceforge.net/help_doc.php', 'http://wurfl.sourceforge.net/help_doc.php'), '!wurfl2' => l('http://drupal.org/project/wurfl', 'http://drupal.org/project/wurfl')))
   );
   return system_settings_form($form);
-} 
+}
 
 /**
  *  Helper function to return the options for definition of the Drupal usage
- */ 
+ */
 function mobile_tools_site_type_options() {
-  $options = array('mobile' => t('Only the mobile site'),  'desktop' => t('only the deskop site'), 'mobile-desktop' => t('for both mobile and desktop site'));  
+  $options = array('mobile' => t('Only the mobile site'),  'desktop' => t('only the deskop site'), 'mobile-desktop' => t('for both mobile and desktop site'));
   return $options;
-} 
+}
 
 /**********************************************************
  * Helper function to integrate with third party modules  *
- **********************************************************/ 
+ **********************************************************/
 /**
- *  Help function that retrieves the modules that implement the 
- *  hook_is_mobile_device() or hook_is_mobile_site() hooks. 
- */  
+ *  Help function that retrieves the modules that implement the
+ *  hook_is_mobile_device() or hook_is_mobile_site() hooks.
+ */
 function _mobile_tools_external($type) {
   switch ($type) {
     case 'device-detection':
@@ -349,12 +349,12 @@ function _mobile_tools_external($type) {
       $modules = mobile_tools_get_module_names(module_implements('devicecapability'));
       unset($modules['mobile_tools']);
     break;
-  }  
+  }
   return $modules;
-} 
+}
 /**
  * return the human readable name of the modules
- */ 
+ */
 function mobile_tools_get_module_names($modules) {
   $output = array();
   foreach ($modules as $module_value) {
@@ -363,8 +363,8 @@ function mobile_tools_get_module_names($modules) {
     if (!empty($item)) {
       $info = $item->info;
       $info = unserialize($info);
-      $output[$module_value] = $info['name']; 
+      $output[$module_value] = $info['name'];
     }
   }
   return $output;
-}
\ No newline at end of file
+}
diff --git a/mobile_tools.install b/mobile_tools.install
index 1f518f9..9e69f3c 100755
--- a/mobile_tools.install
+++ b/mobile_tools.install
@@ -22,8 +22,33 @@ function mobile_tools_uninstall() {
   variable_del('mobile_tools_redirect');
   variable_del('mobile_tools_desktop_url');
   variable_del('mobile_tools_mobile_url');
-  variable_del('mobile-tools-theme-switch');
+  variable_del('mobile_tools_theme_switch');
   variable_del('mobile_tools_theme_name');
+  variable_del('mobile_tools_device_detection');
+  variable_del('mobile_tools_device_capabilities');
+}
+
+/**
+ * Rename variable names with a dash to comply with Drupal coding standards.
+ */
+function mobile_tools_update_7200() {
+  $mt_device_detection = variable_get('mobile-tools-device-detection', 'mobile_tools');
+  $mt_device_capabilities = variable_get('mobile-tools-device-capabilities', 'wurfl');
+  $mt_device_capability = variable_get('mobile-tools-device-capability', 'wurfl');
+  $mt_theme_switch = variable_get('mobile-tools-theme-switch', 'mobile-tools-no-switch');
+  $mt_site_type_detection = variable_get('mobile-tools-site-type-detection', 'mobile_tools');
+
+  variable_set('mobile_tools_device_detection', $mt_device_detection);
+  variable_set('mobile_tools_device_capabilities', $mt_device_capabilities);
+  variable_set('mobile_tools_device_capability', $mt_device_capability);
+  variable_set('mobile_tools_theme_switch', $mt_theme_switch);
+  variable_set('mobile_tools_site_type_detection', $mt_site_type_detection);
+
   variable_del('mobile-tools-device-detection');
   variable_del('mobile-tools-device-capabilities');
-}
\ No newline at end of file
+  variable_del('mobile-tools-device-capability');
+  variable_del('mobile-tools-theme-switch');
+  variable_del('mobile-tools-site-type-detection');
+
+  return t('Renamed incorrect variable names.');
+}
diff --git a/mobile_tools.module b/mobile_tools.module
index 4a17219..628ac29 100755
--- a/mobile_tools.module
+++ b/mobile_tools.module
@@ -11,9 +11,9 @@
  * For more documentation and examples please go to http://drupal.org/node/459686
  */
 
-/* The default messages being displayed to the users . these can be overwritten in 
+/* The default messages being displayed to the users . these can be overwritten in
 * the configuration panel
-*/    
+*/
 define('MOBILE_NOTIFICATION', '<a href="!desktop_url">View full site</a>');
 define('DESKTOP_NOTIFICATION', '<a href="!mobile_url">View mobile site</a>');
 
@@ -80,14 +80,14 @@ function mobile_tools_menu() {
     'weight' => 10,
     'file' => 'mobile_tools.admin.inc',
   );
-  
+
   $items['mt/desktop/%mobile_tools_menu_link'] = array(
    'title' => 'Full site',
    'page callback' => 'mobile_tools_menu_switch_site',
    'access callback' => 'mobile_tools_menu_link_access',
    'access arguments' => array('desktop'),
   );
-  
+
   $items['mt/mobile/%mobile_tools_menu_link'] = array(
    'title' => "Mobile Site",
    'page callback' => 'mobile_tools_menu_switch_site',
@@ -138,7 +138,7 @@ function mobile_tools_menu_switch_site(){
   }
   else {
     $url = $path;
-  } 
+  }
   $query = drupal_get_query_parameters();
   $query['device'] = $site;
   drupal_goto($url, array('query' => $query));
@@ -232,11 +232,11 @@ function mobile_tools_init(){
   if (php_sapi_name() == 'cli') {
     return;
   }
-  // Some small extras   
+  // Some small extras
   if (mobile_tools_site_type() == 'mobile') {
     $conf['default_nodes_main'] = variable_get('default_nodes_main_mobile', variable_get('default_nodes_main', 10));
-  } 
-  
+  }
+
   /**
    * We set the context
    */
@@ -292,14 +292,14 @@ function mobile_tools_device_redirect($device) {
   if (variable_get('mobile_tools_redirect_exceptions_type', 0) == 'only-redirect') {
     $page_match = !$page_match;
   }
-  // Redirections 
+  // Redirections
   if (!$page_match) {
     // The case where a mobile user is accessing the desktop site
     if ($device['type'] == 'mobile' && $current_url_type == 'desktop') {
         $destination_url = mobile_tools_get_redirect_url('mobile');
         mobile_tools_goto($destination_url);
-    // The case where a desktop user is accessing the mobile site 
-    } 
+    // The case where a desktop user is accessing the mobile site
+    }
     elseif ($device['type'] == 'desktop' && $current_url_type == 'mobile') {
        $destination_url = mobile_tools_get_redirect_url('desktop');
        mobile_tools_goto($destination_url);
@@ -315,9 +315,9 @@ function mobile_tools_switch_theme($device) {
   global $custom_theme, $conf;
   // check if theme switching is forced
   $current_url_type = mobile_tools_site_type();
-  if (($current_url_type == 'mobile' &&  variable_get('mobile-tools-theme-switch', ''  ) == 'mobile-tools-mobile-url') || (variable_get('mobile-tools-theme-switch', ''  ) == 'mobile-tools-mobile-device' && $device['type']  == 'mobile') ) {
+  if (($current_url_type == 'mobile' &&  variable_get('mobile_tools_theme_switch', ''  ) == 'mobile-tools-mobile-url') || (variable_get('mobile_tools_theme_switch', ''  ) == 'mobile-tools-mobile-device' && $device['type']  == 'mobile') ) {
     $group = $device['group'];
-    $mobile_detection_module = variable_get('mobile-tools-device-detection', 'mobile_tools');
+    $mobile_detection_module = variable_get('mobile_tools_device_detection', 'mobile_tools');
     if (variable_get($mobile_detection_module . '_' . $group . '_enable', '') == 1) {
       $custom_theme = variable_get($mobile_detection_module . '_' . $group . '_theme', $conf['theme_default']);
       return $custom_theme;
@@ -330,7 +330,7 @@ function mobile_tools_switch_theme($device) {
   elseif (!empty($device['group'])){ //device groups are independent of device types
     // Allow custom themes for 'desktop' device types
     $group = $device['group'];
-    $mobile_detection_module = variable_get('mobile-tools-device-detection', 'mobile_tools');
+    $mobile_detection_module = variable_get('mobile_tools_device_detection', 'mobile_tools');
     if (variable_get($mobile_detection_module . '_' . $group . '_enable', '') == 1) {
       $custom_theme = variable_get($mobile_detection_module . '_' . $group . '_theme', $conf['theme_default']);
       return $custom_theme;
@@ -404,7 +404,7 @@ function mobile_tools_get_device() {
  *  The $device object. Other modules can implement the hook_is_mobile_device()
  */
 function mobile_tools_is_mobile_device() {
-  $device_detection = variable_get('mobile-tools-device-detection', 'mobile_tools');
+  $device_detection = variable_get('mobile_tools_device_detection', 'mobile_tools');
   drupal_load('module', $device_detection);
   if ($device_detection != 'mobile_tools') {
     return module_invoke($device_detection, 'is_mobile_device');
@@ -512,7 +512,7 @@ function _mobile_tools_is_mobile_device() {
  *  Detection of the site type . the values comes out the configuration form.
  */
 function mobile_tools_site_type(){
-  $site_detection = variable_get('mobile-tools-site-type-detection', 'mobile_tools');
+  $site_detection = variable_get('mobile_tools_site_type_detection', 'mobile_tools');
   drupal_load('module', $site_detection);
   if ($site_detection == 'mobile_tools') {
     return _mobile_tools_site_detection();
@@ -530,14 +530,14 @@ function mobile_tools_site_type(){
 function _mobile_tools_site_detection() {
   global $base_url, $mobile_tools_device;
   // Easy detection in case redireciton is disabled and device specific theme switching is enabled
-  if(!variable_get('mobile_tools_redirect', 0) && variable_get('mobile-tools-theme-switch', '' ) == 'mobile-tools-mobile-device'){
+  if(!variable_get('mobile_tools_redirect', 0) && variable_get('mobile_tools_theme_switch', '' ) == 'mobile-tools-mobile-device'){
     if($mobile_tools_device['type']  == 'mobile'){
       return 'mobile';
     }
     else {
       return 'desktop';
     }
-  } 
+  }
   // Check if $_SERVER variables are set if not, just return desktop... Still unclear what best solution is:
   if (!isset($_SERVER['HTTP_HOST']) && !isset($_SERVER['SERVER_NAME'])) {
     return 'desktop';
@@ -600,7 +600,7 @@ function _mobile_tools_site_detection() {
  *  Array containing the device group detected by this module
  */
 function mobile_tools_device_groups() {
-  $device_detection = variable_get('mobile-tools-device-detection', 'mobile_tools');
+  $device_detection = variable_get('mobile_tools_device_detection', 'mobile_tools');
   drupal_load('module', $device_detection);
   if ($device_detection != 'mobile_tools') {
     return module_invoke($device_detection, 'device_groups');
@@ -624,7 +624,7 @@ function _mobile_tools_device_groups() {
  * This default implementation invokes the responsible module
  */
 function mobile_tools_devicecapability($capability) {
-  return module_invoke(variable_get('mobile-tools-device-capability', 'wurfl'), 'devicecapability', $capability);
+  return module_invoke(variable_get('mobile_tools_device_capability', 'wurfl'), 'devicecapability', $capability);
 }
 
 /**
@@ -650,7 +650,7 @@ function mobile_tools_prepare_url($url) {
 function mobile_tools_get_redirect_url($destination_site) {
   include_once DRUPAL_ROOT . '/' . './includes/bootstrap.inc';
   drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-  $destination_url = ($destination_site == 'mobile') ? variable_get('mobile_tools_mobile_url', '') :  $destination =  variable_get('mobile_tools_desktop_url', ''); 
+  $destination_url = ($destination_site == 'mobile') ? variable_get('mobile_tools_mobile_url', '') :  $destination =  variable_get('mobile_tools_desktop_url', '');
   // collect query parameters
   if (drupal_is_front_page()) {
     return $destination_url;
@@ -733,7 +733,7 @@ function mobile_tools_form_alter(&$form, $form_state, $form_id) {
 }
 
 /**
- * Implementation of hook_alter() 
+ * Implementation of hook_alter()
  *  - inserting some javascript to hide navigation bar
  */
 function mobile_tools_page_alter(&$page){
@@ -768,7 +768,7 @@ function mobile_tools_html_head_alter(&$head_elements){
         'content' => 'user-scalable=no, width=device-width, maximum-scale=1.0',
       ),
     );
-    
+
     $head_elements['apple_mobile_web_app_capable'] = array(
       '#type' => 'html_tag',
       '#tag' => 'meta',
@@ -777,7 +777,7 @@ function mobile_tools_html_head_alter(&$head_elements){
         'content' => 'yes',
       ),
     );
-    
+
     $head_elements['HandheldFriendly'] = array(
       '#type' => 'html_tag',
       '#tag' => 'meta',
@@ -786,7 +786,7 @@ function mobile_tools_html_head_alter(&$head_elements){
         'content' => 'true',
       ),
     );
-  }  
+  }
 }
 
 /**
@@ -871,7 +871,7 @@ function mobile_tools_context_plugins() {
   );
   return $plugins;
 }
-        
+
 function mobile_tools_context_registry() {
   return array(
     'conditions' => array(
@@ -882,4 +882,4 @@ function mobile_tools_context_registry() {
       ),
     ),
   );
-}
\ No newline at end of file
+}
diff --git a/mobile_tools_roles.inc b/mobile_tools_roles.inc
index 8f8b4d5..c1f85db 100644
--- a/mobile_tools_roles.inc
+++ b/mobile_tools_roles.inc
@@ -11,7 +11,7 @@ function mobile_tools_roles_boot() {
   if ($item->count > 0) {
     foreach ($roles as $key => $value) {
       $role = mobile_tools_roles_info(array('id' => $key));
-      if ($role->type == 'desktop' && $role->has_sibling == 1 && ($_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile-tools-theme-switch', FALSE) == 'mobile-tools-mobile-device'))) {
+      if ($role->type == 'desktop' && $role->has_sibling == 1 && ($_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile_tools_theme_switch', FALSE) == 'mobile-tools-mobile-device'))) {
         unset($user->roles[$key]);
         $user->roles[$role->sibling['id']] = $role->sibling['name'];
       }
diff --git a/mobile_tools_roles.module b/mobile_tools_roles.module
index 010bfe0..39001e0 100644
--- a/mobile_tools_roles.module
+++ b/mobile_tools_roles.module
@@ -29,7 +29,7 @@ function mobile_tools_roles_boot() {
   if ($item->count > 0) {
     foreach ($roles as $key => $value) {
       $role = mobile_tools_roles_info(array('id' => $key));
-      if ($role->type == 'desktop' && $role->has_sibling == 1 && ($_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile-tools-theme-switch', FALSE) == 'mobile-tools-mobile-device'))) {
+      if ($role->type == 'desktop' && $role->has_sibling == 1 && ($_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile_tools_theme_switch', FALSE) == 'mobile-tools-mobile-device'))) {
         unset($user->roles[$key]);
         $user->roles[$role->sibling['id']] = $role->sibling['name'];
       }
@@ -315,4 +315,4 @@ function mobile_tools_edit_mobile_role($op, $role) {
   ->execute();
       break;
   }
-}
\ No newline at end of file
+}
