diff --git a/changelog b/changelog
deleted file mode 100644
index a79ed5f..0000000
--- a/changelog
+++ /dev/null
@@ -1,70 +0,0 @@
-Submenu Tree
-
-
-=======
-6.x-1.3
-
-Added new feature: Extended primary links block. 
-
-The Extended primary links block extends the primary links menu into a block. 
-
-In other words, the Extended primary links block selects the menu designated as the primary links menu and displays the rest of that menu (ie. from the second or third level downwards) in a block. 
-
-If no primary links menu exist, it will use the secondary links menu if that exists. 
-
-
-=======
-6.x-1.2
-
-#272518: Siblingmenue not shown if no submenues found
-
-
-=======
-6.x-1.1
-
-Critical bugfix: #265453: Table 'drupal.node_submenutree' doesn't exist
-
-
-=======
-6.x-1.0
-
-First port to Drupal 6.x.
-#247198: Titles Only View -> Links. Displaying as titles now works. Minor bugfix.
-
-If upgrading drupal core from 5.x to 6.x, please first upgrade submenutree to 5.x-0.4 before upgrading to 6.x-1.0. 
-
-
-=======
-5.x-1.0
-
-Bring 5.x version up to 1.0 to match 6.x versioning.
-#247198: Titles Only View -> Links. Displaying as titles now works. Minor bugfix.
-
-
-=======
-5.x-0.4
-
-Changed database table schema (and associated code refactoring)
-Added configurable titles (#188753)
-Added sibling menus (#188753)
-
-(Please read the readme for upgrading instructions)
-
-
-=======
-5.x-0.3
-
-Proper ordering of items (#189604).
-
-=======
-5.x-0.2
-
-Submenu Tree can be displayed in a block (#186880).
-
-
-=======
-5.x-0.1
-
-First release
-
-
diff --git a/readme.txt b/readme.txt
index 7e3c47c..f4328e2 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,103 +1,88 @@
 Submenu Tree
-May 2008
+June, 2011
 
-For instructions on upgrading from Submenu Tree 5.x-0.x to 6.x-x.x, please see below. 
+For instructions on how to upgrade from Submenu Tree 6.x to 7.x please see below.
 
-For instructions on upgrading from Submenu Tree 0.3 to 0.4, please see below. 
 
 ============
 Introduction
 ------------
 
-For those nodes which are menu items and displayed as such, this module can append or prepend a listing of the submenu items underneath that node. The submenu items can be themed as a submenu, a list of titles, a list of teasers, or a list of full nodes. 
+For content which has a menu, Submenu Tree allows content authors to list that content's sub or sibling menu items. These items can be displayed as a menu, a list of titles, a list of teasers, or a list of full pages.
 
-This module is yet another solution to the long standing issue of hierarchical content in Drupal, hence it attempts to solve problems which other people have used modules such as book.module, taxonomy.module, category.module, menutree.module, and menupage.module to address. Submenu Tree aims to be a convenient and lightweight complement to these modules. 
+Submenu Tree attempts to solve the problem of creating structured content by allowing content editors to define a hierarchy of content.
 
-Submenu Tree presumes you are using the Drupal menu system for organising a hierarchy. 
 
-Here are some possible reasons why you might consider Submenu Tree over other modules. 
-
-Book, Taxonomy, Category:
-
-Submenu Tree is much easier to set up than these modules and there is very little configuration. If Submenu Tree doesn't fit your needs, then feel free to explore these other modules. 
-
-Menutree, Menupage:
+=====
+Installation
+-----
 
-Menutree and Menupage both allows for a menu to be displayed as a separate page. However, there is no way to have associated content. Furthermore with menupage, nodes can be placed only at the leaves of a menu. 
+Submenu Tree does not require any special installation instructions; install it as you would any other module.
 
-Submenu Tree provides for content such as an introduction, header, or image to accompanying the menu listing. It can also display the submenu items in other ways ie teaser, full nodes. With theming, you can render the submenu items any way you wish. 
+1. Extract the module into the sites/all/modules directory (or use your own location if you understand what you are doing).
+2. Enable the module at Modules.
 
-Please note Submenu Tree is not related to Menutree in any way. It is named similarly because it offers something similar. 
 
-Blocks:
+============
+Configuration
+------------
 
-Submenu Tree allows the submenu items to be displayed within content or in a block. Displaying in a block allows you to move the blocks to wherever you wish. 
+Submenu Tree allows administrators to set default configuration options. These options will be automatically selected whenever new content is created.
 
-Breadcrumbs:
+Configuration options can be found under Configuration >> Content Authoring >> Submenu Tree
 
-Since Submenu Tree uses the Drupal menu system, breadcrumbs work automatically. 
 
-Submenu Titles:
+============
+Usage
+------------
 
-Submenu Tree allows you to change the title of the submenu to whatever you wish. 
+* Please note that Submenu Tree will only take effect if your content is part of a menu.
 
-Sibling Menu:
+Submenu Tree provides two different options menus.
 
-Submenu Tree now also provides a sibling menu tree, which is an analagous feature displaying the items at the same menu level as the node ie. instead of displaying a submenu, it displays the submenu of its parent. 
+When creating or editing content, you now have the option to specify submenu tree settings or siblingmenu tree settings.
 
-Note that, in practice, this may not quite be what it sounds. YMMV.
+Submenu Tree
+A submenu tree displays items that are directly underneath the content's menu level.
 
+Siblingmenu Tree
+A siblingmenu tree displays items that are at the same menu level as the content ie.
 
+Content vs. Block
 
-=====
-Usage
------
+Submenu Tree allows the sub or sibling menu items to be displayed within content or in a block. If you choose to display content in a block, then you must enable and position one of the included Submenu Tree blocks using the block layout interface found at Structure >> Blocks.
 
-0. Install Submenu Tree as like any module ie. unzip and copy the files into sites/all/modules/submenutree (or use your own method if you know what you are doing)
+Available Blocks
 
-1. Goto Administer >> Site Building >> Modules and enable Submenu Tree. 
+Submenu Tree Display
+If the current content has submenu block options selected, those options will be displayed in this block.
 
-That's installation done. 
+Siblingmenu Tree Display
+If the current content has siblingmenu block options selected, those options will be displayed in this block.
 
-When you are editing a node, you should now see a section entitled Menu Settings -> Submenu Tree Settings. Make your selection there and click Submit. 
-
-If you disable submenu trees for your node, the settings are lost for that node. 
-
-Please also note Submenu Tree will only take effect if you are viewing a node which is part of a Drupal menu. If you are viewing a node which is not part of a menu, this module will seem to do nothing. 
+Extended Main Links
+This block selects the menu designated as the main links menu (or the secondary links menu if main links in unavailalbe) and displays the rest of that menu (ie. from the second or third level downwards) in a block.
 
 
 =========
 Upgrading
 ---------
 
-Version 5.x-0.4 to 6.x-1.0
-
-If upgrading drupal core from 5.x to 6.x, please first upgrade submenutree to 5.x-0.4 before upgrading to 6.x-1.0. 
-
-
-Version 0.3 -> 0.4
-
-There were some significant changes between versions 0.3 and 0.4. Among other things, the database table schema changed, there was some code refactoring, and the API for the themeable functions changed as well. If you are upgrading from 0.3 to 0.4, please be aware of this and test thoroughly. 
-
-In particular, if you have overridden the themeable functions, then you must adjust them accordingly. 
+Version 6.x to 7.x
 
-To upgrade from 0.3 to 0.4, there are two ways. For either, it is highly recommended that you BACK UP your database first. 
+If you are upgrading Drupal core from 6.x to 7.x, you should first upgrade submenutree to the latest 6.x release before proceeding with the update.
 
-The first and recommended way is:
+As with any upgrade operation, it is recommended that you back up your database first.
 
-1. Disable the module (version 0.3), uninstall it, and remove it entirely from sites/all/modules/submenutree (or wherever you have installed the module)
+Upgrading to Submenu Tree 7.x:
 
-2. Install the module (version 0.4) and then reconfigure all your nodes
+1. Disable then remove the 6.x version of Submenu Tree.
 
-Unfortunately, all your settings will be lost so you'll have to redo them. 
+2. Install the latest 7.x version of Submenu Tree.
 
-The second way is if you're feeling lazy or you don't mind taking risks. It has been tested to work, and should work, but you have been warned. 
+3. Run the database update process. This process can be found under Reports >> Status report.
 
-1. In sites/all/modules/submenutree (or wherever you have installed the module), overwrite version 0.3 with version 0.4
-
-2. Use the database update script update.php (which you can also reach from Home >> Administer >> Logs >> Status Report) to run update #5001 for Submenu Tree
-
-If the update is successful, it should migrate all your existing Submenu Tree-ed nodes to the new schema. 
+If the update is successful, it should migrate all of your existing Submenu Tree content.
 
 
 =======
@@ -105,8 +90,4 @@ Credits
 -------
 
 Submenu Tree contributed by ThinkLeft (http://thinkleft.com)
-
-Please see the website for more information or if enquiring about commercial Drupal or other non-Drupal technology services. 
-
-
-
+Please see the website for more information or if enquiring about commercial Drupal or other non-Drupal technology services.
diff --git a/submenutree.install b/submenutree.install
index 9a1cfa9..19a61b1 100644
--- a/submenutree.install
+++ b/submenutree.install
@@ -1,9 +1,8 @@
 <?php
-// Modeline for drupal
-// vim: set expandtab tabstop=2 shiftwidth=2 autoindent smartindent filetype=php:
 
 /**
- * Implementation of hook_schema().
+ * @file
+ * Implements hook_schema().
  */
 function submenutree_schema() {
   $schema['node_submenutree'] = array(
@@ -24,27 +23,6 @@ function submenutree_schema() {
   return $schema;
 }
 
-/* This is an update from submenutree 5.x-0.x. Leave it here for now  */
-function submenutree_update_5001() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_enable int(10) unsigned NOT NULL default '0' AFTER nid");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_title varchar(255) NOT NULL default '' AFTER submenutree_enable");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE display submenutree_display int(10) unsigned NOT NULL default '0'");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE weight submenutree_weight int(10) unsigned NOT NULL default '0'");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_enable int(10) unsigned NOT NULL default '0'");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_title varchar(255) NOT NULL default ''");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_display int(10) unsigned NOT NULL default '0'");
-      $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_weight int(10) unsigned NOT NULL default '0'");
-
-      $ret[] = update_sql("UPDATE {node_submenutree} SET submenutree_enable = 1");
-    break;
-  }
-  return $ret;
-}
-
 /**
  * Make columns submenutree_weight and siblingmenutree_weight signed integers.
  * See http://drupal.org/node/455690
@@ -61,4 +39,3 @@ function submenutree_update_6001() {
   }
   return $ret;
 }
-
diff --git a/submenutree.module b/submenutree.module
index fbe3eb6..36db069 100644
--- a/submenutree.module
+++ b/submenutree.module
@@ -2,7 +2,7 @@
 /**
  * @file
  * Submenu Tree
- * 
+ *
  */
 
 define('SUBMENUTREE_DISPLAY_MENU', 0);
@@ -24,18 +24,159 @@ define('SUBMENUTREE_BLOCK_SUBMENU', 0);
 define('SUBMENUTREE_BLOCK_SIBLINGMENU', 1);
 
 /**
+ * Implements hook_help().
+ */
+function submenutree_help($path, $arg) {
+  switch ($path) {
+    case 'admin/config/content/submenutree':
+      $output = '<p>' . t('For content which has a menu, Submenu Tree allows content authors to append or prepend a listing of the submenu items above or below that content. The submenu items can be displayed as a submenu, a list of titles, a list of teasers, or a list of full pages.') . '</p>';
+      $output .= '<p>' . t('Configure the default settings for Submenu Tree. These settings will be used when creating new content.') . '</p>';
+      return $output;
+  }
+}
+
+/**
+ * Implements hook_menu().
+ */
+function submenutree_menu() {
+  $items = array();
+
+  $items['admin/config/content/submenutree'] = array(
+    'title' => 'Submenu Tree',
+    'description' => 'Configure default options for sub and sibling menus.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('submenutree_form'),
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+
+  return $items;
+}
+
+/**
+ * Form function, called by drupal_get_form()
+ * in submenutree_menu().
+ */
+function submenutree_form($form, &$form_state) {
+  // Fieldgroups
+  $form['submenu'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Submenu default options'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+
+  $form['siblingmenu'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Siblingmenu default options'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+
+  // Submenu Title
+  $form['submenu']['submenutree_submenu_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title'),
+    '#default_value' => variable_get('submenutree_submenu_title', ''),
+    '#description' => t('The default title of the submenu tree content or block. If you leave this blank, the submenu tree content will have no title, or the submenu tree block will use the node title.'),
+  );
+
+  // Submenu Display
+  $form['submenu']['submenutree_submenu_display'] = array(
+    '#type' => 'select',
+    '#title' => t('Display siblingmenu trees as'),
+    '#options' => array(
+      'content' => array(
+        SUBMENUTREE_DISPLAY_MENU => t('Menu'),
+        SUBMENUTREE_DISPLAY_TITLES => t('Titles only'),
+        SUBMENUTREE_DISPLAY_TEASERS => t('Teasers'),
+        SUBMENUTREE_DISPLAY_TEASERS_LINKS => t('Teasers with links'),
+        SUBMENUTREE_DISPLAY_FULLTEXT => t('Full text'),
+        SUBMENUTREE_DISPLAY_FULLTEXT_LINKS => t('Full text with links'),
+        ),
+      'block' => array(
+        SUBMENUTREE_DISPLAY_BLOCK_MENU => t('Menu'),
+        SUBMENUTREE_DISPLAY_BLOCK_TITLES => t('Titles only'),
+        SUBMENUTREE_DISPLAY_BLOCK_TEASERS => t('Teasers'),
+        SUBMENUTREE_DISPLAY_BLOCK_TEASERS_LINKS => t('Teasers with links'),
+        SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT => t('Full text'),
+        SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT_LINKS => t('Full text with links'),
+        ),
+    ),
+    '#default_value' => variable_get('submenutree_submenu_display', SUBMENUTREE_DISPLAY_MENU),
+    '#description' => t('Select where and how the submenu tree should be displayed by default. If selecting a block display, the block also needs to be made visible.'),
+    '#required' => TRUE,
+  );
+
+  // Submenu Weight
+  $form['submenu']['submenutree_submenu_weight'] = array(
+    '#type' => 'weight',
+    '#title' => t('Weight'),
+    '#default_value' => variable_get('submenutree_submenu_weight', 1),
+    '#description' => t('The default weight of the submenu tree listing. This only applies when displaying as content and affects where the submenu tree appears in the content.'),
+    '#required' => TRUE,
+  );
+
+  // Siblingmenu Title
+  $form['siblingmenu']['submenutree_siblingmenu_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title'),
+    '#default_value' => variable_get('submenutree_siblingmenu_title', ''),
+    '#description' => t('The default title of the siblingmenu tree content or block. If you leave this blank, the siblingmenu tree content will have no title, or the siblingmenu tree block will use the node title.'),
+  );
+
+  // Siblingmenu Display
+  $form['siblingmenu']['submenutree_siblingmenu_display'] = array(
+    '#type' => 'select',
+    '#title' => t('Display siblingmenu trees as'),
+    '#options' => array(
+      'content' => array(
+        SUBMENUTREE_DISPLAY_MENU => t('Menu'),
+        SUBMENUTREE_DISPLAY_TITLES => t('Titles only'),
+        SUBMENUTREE_DISPLAY_TEASERS => t('Teasers'),
+        SUBMENUTREE_DISPLAY_TEASERS_LINKS => t('Teasers with links'),
+        SUBMENUTREE_DISPLAY_FULLTEXT => t('Full text'),
+        SUBMENUTREE_DISPLAY_FULLTEXT_LINKS => t('Full text with links'),
+        ),
+      'block' => array(
+        SUBMENUTREE_DISPLAY_BLOCK_MENU => t('Menu'),
+        SUBMENUTREE_DISPLAY_BLOCK_TITLES => t('Titles only'),
+        SUBMENUTREE_DISPLAY_BLOCK_TEASERS => t('Teasers'),
+        SUBMENUTREE_DISPLAY_BLOCK_TEASERS_LINKS => t('Teasers with links'),
+        SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT => t('Full text'),
+        SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT_LINKS => t('Full text with links'),
+        ),
+      ),
+    '#default_value' => variable_get('submenutree_siblingmenu_display', SUBMENUTREE_DISPLAY_MENU),
+    '#description' => t('Select where and how the siblingmenu tree should be displayed by default. If selecting a block display, the block also needs to be made visible.'),
+    '#required' => TRUE,
+  );
+
+  // Siblingmenu Weight
+  $form['siblingmenu']['submenutree_siblingmenu_weight'] = array(
+    '#type' => 'weight',
+    '#title' => t('Weight'),
+    '#default_value' => variable_get('submenutree_siblingmenu_weight', 1),
+    '#description' => t('The default weight of the siblingmenu tree listing. This only applies when displaying as content and affects where the siblingmenu tree appears in the content.'),
+    '#required' => TRUE,
+  );
+
+  return system_settings_form($form);
+}
+
+/**
  * Implements hook_form_BASE_ID_alter().
  */
 function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
   // Only show submenutree if menu is also editable
   if (!empty($form['menu'])) {
     $node = $form['#node'];
-    
+
     $form['submenutree'] = array(
       '#type' => 'fieldset',
       '#group' => 'additional_settings',
       '#title' => t('Submenu tree settings'),
-      '#collapsible' => true,
+      '#collapsible' => TRUE,
       '#collapsed' => empty($node->submenutree_enable),
 
       'submenutree_enable' => array(
@@ -47,7 +188,7 @@ function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
       'submenutree_title' => array(
         '#type' => 'textfield',
         '#title' => t('Title'),
-        '#default_value' => isset($node->submenutree_title) ? $node->submenutree_title : '',
+        '#default_value' => isset($node->submenutree_title) ? $node->submenutree_title : variable_get('submenutree_submenu_title', ''),
         '#description' => t('The title of the submenu tree content or block. If you leave this blank, the submenu tree content will have no title, or the submenu tree block will use the node title.'),
       ),
 
@@ -72,14 +213,14 @@ function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
             SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT_LINKS => t('Full text with links'),
             ),
         ),
-        '#default_value' => isset($node->submenutree_display) ? $node->submenutree_display : SUBMENUTREE_DISPLAY_MENU,
+        '#default_value' => isset($node->submenutree_display) ? $node->submenutree_display : variable_get('submenutree_submenu_display', SUBMENUTREE_DISPLAY_MENU),
         '#description' => t('Select where and how the submenu tree should be displayed. If selecting a block display, the block also needs to be made visible.'),
       ),
 
       'submenutree_weight' => array(
         '#type' => 'weight',
         '#title' => t('Weight'),
-        '#default_value' => isset($node->submenutree_weight) ? $node->submenutree_weight : 1,
+        '#default_value' => isset($node->submenutree_weight) ? $node->submenutree_weight : variable_get('submenutree_submenu_weight', 1),
         '#description' => t('The weight of the submenu tree listing. This only applies when displaying as content and affects where the submenu tree appears in the content.'),
       ),
     );
@@ -88,7 +229,7 @@ function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
       '#type' => 'fieldset',
       '#group' => 'additional_settings',
       '#title' => t('Siblingmenu tree settings'),
-      '#collapsible' => true,
+      '#collapsible' => TRUE,
       '#collapsed' => empty($node->siblingmenutree_enable),
 
       'siblingmenutree_enable' => array(
@@ -100,7 +241,7 @@ function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
       'siblingmenutree_title' => array(
         '#type' => 'textfield',
         '#title' => t('Title'),
-        '#default_value' => isset($node->siblingmenutree_title) ? $node->siblingmenutree_title : '',
+        '#default_value' => isset($node->siblingmenutree_title) ? $node->siblingmenutree_title : variable_get('submenutree_siblingmenu_title', ''),
         '#description' => t('The title of the siblingmenu tree content or block. If you leave this blank, the siblingmenu tree content will have no title, or the siblingmenu tree block will use the node title.'),
       ),
 
@@ -125,18 +266,18 @@ function submenutree_form_node_form_alter(&$form, &$form_state, $form_id) {
             SUBMENUTREE_DISPLAY_BLOCK_FULLTEXT_LINKS => t('Full text with links'),
             ),
         ),
-        '#default_value' => isset($node->siblingmenutree_display) ? $node->siblingmenutree_display : SUBMENUTREE_DISPLAY_MENU,
+        '#default_value' => isset($node->siblingmenutree_display) ? $node->siblingmenutree_display : variable_get('submenutree_siblingmenu_display', SUBMENUTREE_DISPLAY_MENU),
         '#description' => t('Select where and how the siblingmenu tree should be displayed. If selecting a block display, the block also needs to be made visible.'),
       ),
 
       'siblingmenutree_weight' => array(
         '#type' => 'weight',
         '#title' => t('Weight'),
-        '#default_value' => isset($node->siblingmenutree_weight) ? $node->siblingmenutree_weight : 1,
+        '#default_value' => isset($node->siblingmenutree_weight) ? $node->siblingmenutree_weight : variable_get('submenutree_siblingmenu_weight', 1),
         '#description' => t('The weight of the siblingmenu tree listing. This only applies when displaying as content and affects where the siblingmenu tree appears in the content.'),
       ),
     );
-  } 
+  }
 }
 
 /**
@@ -190,14 +331,14 @@ function submenutree_node_delete($node) {
 function submenutree_node_view($node, $view_mode, $langcode) {
   if ($view_mode == 'full' && node_is_page($node) && (!empty($node->submenutree_enable) || !empty($node->siblingmenutree_enable))) {
     $mlid = 0;
-    // Other modules may override which mlid to use. Use the first available value. 
+    // Other modules may override which mlid to use. Use the first available value.
     foreach (module_implements('submenutree_mlid') as $module) {
       $function = $module . '_submenutree_mlid';
       if ($mlid = $function($node)) {
         break;
       }
     }
-    
+
     // Else, give priority to the default menu defined by the Menu module.
     // This stanza is from menu_node_prepare()
     if (!$mlid) {
@@ -239,17 +380,17 @@ function submenutree_node_view($node, $view_mode, $langcode) {
 
       // Sanity check that we did find something
       if ($my_tree && $node->submenutree_enable) {
-        _submenutree_menutree_view($node, 'submenutree', $my_tree);          
+        _submenutree_menutree_view($node, 'submenutree', $my_tree);
       }
       if ($parent_tree && $node->siblingmenutree_enable) {
-        _submenutree_menutree_view($node, 'siblingmenutree', $parent_tree);          
+        _submenutree_menutree_view($node, 'siblingmenutree', $parent_tree);
       }
     }
   }
 }
 
 /**
- * Implements of hook_block_info().
+ * Implements hook_block_info().
  */
 function submenutree_block_info() {
   $blocks = array();
@@ -257,13 +398,13 @@ function submenutree_block_info() {
   $blocks[SUBMENUTREE_BLOCK_SUBMENU]['cache'] = DRUPAL_CACHE_PER_PAGE;
   $blocks[SUBMENUTREE_BLOCK_SIBLINGMENU]['info'] = t('Siblingmenu Tree Display');
   $blocks[SUBMENUTREE_BLOCK_SIBLINGMENU]['cache'] = DRUPAL_CACHE_PER_PAGE;
-  $blocks[2]['info'] = 'Extended Primary Links';
+  $blocks[2]['info'] = 'Extended Main Links';
   $blocks[2]['cache'] = DRUPAL_CACHE_PER_PAGE;
   return $blocks;
 }
 
 /**
- * Implements of hook_block_view().
+ * Implements hook_block_view().
  */
 function submenutree_block_view($delta = '') {
   switch ($delta) {
@@ -273,7 +414,7 @@ function submenutree_block_view($delta = '') {
       break;
 
     case 2:
-      return _submenutree_block_extended_primary_links();
+      return _submenutree_block_extended_main_links();
   }
 }
 
@@ -299,9 +440,9 @@ function submenutree_theme() {
 
 /**
  * View the menu tree, either by poking into $node->content, or via the block functions
- * 
+ *
  * @param $node
- *   The node being operated upon. This is also used for configuration information. 
+ *   The node being operated upon. This is also used for configuration information.
  * @param $type
  *   The type of menu to produce, either "submenutree" or "siblingmenutree"
  * @param $tree
@@ -323,11 +464,11 @@ function _submenutree_menutree_view($node, $type, $tree) {
     if ($block_title == '')
       $block_title = $node->title;
     // wipe out $title so it doesn't get passed into the theme functions
-    $title = null;
+    $title = NULL;
   }
   else {
     if ($title == '')
-      $title = null;
+      $title = NULL;
   }
 
   $output = '';
@@ -339,7 +480,7 @@ function _submenutree_menutree_view($node, $type, $tree) {
     foreach ($tree as $k => $v) {
       // Check that this is a node view
       if (empty($v['link']['hidden']) && strpos($v['link']['href'], 'node/') === 0) {
-        $nid = substr($v['link']['href'], 5);
+        $nid = drupal_substr($v['link']['href'], 5);
         $child = node_load($nid);
         $items[] = array('node' => $child, 'weight' => $v['link']['weight'], 'title' => check_plain($v['link']['title']));
       }
@@ -347,20 +488,20 @@ function _submenutree_menutree_view($node, $type, $tree) {
     _submenutree_sort_items($items);
 
     // Now render our links or our nodes
-    $links = false;
+    $links = FALSE;
     switch ($display) {
       case SUBMENUTREE_DISPLAY_TITLES:
         $output = theme('submenu_tree_titles', array('items' => $items, 'title' => $title));
         break;
 
       case SUBMENUTREE_DISPLAY_TEASERS_LINKS:
-        $links = true;
+        $links = TRUE;
       case SUBMENUTREE_DISPLAY_TEASERS:
         $output = theme('submenu_tree_teasers', array('items' => $items, 'title' => $title, 'links' => $links));
         break;
 
       case SUBMENUTREE_DISPLAY_FULLTEXT_LINKS:
-        $links = true;
+        $links = TRUE;
       case SUBMENUTREE_DISPLAY_FULLTEXT:
         $output = theme('submenu_tree_fulltext', array('items' => $items, 'title' => $title, 'links' => $links));
         break;
@@ -376,8 +517,8 @@ function _submenutree_menutree_view($node, $type, $tree) {
     }
     else {
       $blocks_map = array(
-        'submenutree' => SUBMENUTREE_BLOCK_SUBMENU, 
-        'siblingmenutree' => SUBMENUTREE_BLOCK_SIBLINGMENU, 
+        'submenutree' => SUBMENUTREE_BLOCK_SUBMENU,
+        'siblingmenutree' => SUBMENUTREE_BLOCK_SIBLINGMENU,
       );
       _submenutree_set_block_content($blocks_map[$type], array('subject' => $block_title, 'content' => $output));
     }
@@ -388,7 +529,7 @@ function _submenutree_menutree_view($node, $type, $tree) {
  * $block should be an array like those used in hook_block
  *    ie array('subject' => 'title', 'content' => 'some content');
  */
-function _submenutree_set_block_content($delta, $block = null) {
+function _submenutree_set_block_content($delta, $block = NULL) {
   static $stored_content = array(
     SUBMENUTREE_BLOCK_SUBMENU => array(),
     SUBMENUTREE_BLOCK_SIBLINGMENU => array(),
@@ -405,21 +546,20 @@ function _submenutree_get_block_content($delta) {
 }
 
 /**
- * Return block of extended primary links
- * 
+ * Return block of extended main links
  */
-function _submenutree_block_extended_primary_links() {
+function _submenutree_block_extended_main_links() {
   // Choose the appropriate menu root
-  $primary_name = variable_get('menu_main_links_source', 'main-menu');
+  $main_name = variable_get('menu_main_links_source', 'main-menu');
   $secondary_name = variable_get('menu_secondary_links_source', 'user-menu');
-  if ($primary_name) {
-    $menu_name = $primary_name;
-    if ($primary_name != $secondary_name)            
-      $level = 1;    // Select the second level of the primary menu
+  if ($main_name) {
+    $menu_name = $main_name;
+    if ($main_name != $secondary_name)
+      $level = 1;    // Select the second level of the main menu
     else
-      $level = 2;    // Select the third level of the primary menu
+      $level = 2;    // Select the third level of the main menu
   }
-  else if ($secondary_name) {
+  elseif ($secondary_name) {
     $menu_name = $secondary_name;
     $level = 1;    // Select the second level of the secondary menu
   }
@@ -427,7 +567,7 @@ function _submenutree_block_extended_primary_links() {
     break;
   }
 
-  // Loosely derived from menu_navigation_links()        
+  // Loosely derived from menu_navigation_links()
   $parent = FALSE;
   $tree = menu_tree_page_data($menu_name);
   // Go down the active trail until the right level is reached.
@@ -456,7 +596,7 @@ function _submenutree_block_extended_primary_links() {
 
 /**
  * Sort an array of items.
- * 
+ *
  * @param $items
  *   The array of items to be sorted.
  */
@@ -486,7 +626,7 @@ function _submenutree_sort_items_compare($a, $b) {
 function theme_submenu_tree_menu($variables) {
   $output = '';
   if (isset($variables['title']))
-    $output .= '<h3>'. $variables['title'] .'</h3>';
+    $output .= '<h3>' . $variables['title'] . '</h3>';
   $output .= drupal_render(menu_tree_output($variables['tree']));
   return $output;
 }
@@ -496,14 +636,14 @@ function theme_submenu_tree_titles($variables) {
   $list = array();
   foreach ($items as $item) {
     $list[] = l($item['node']->title, 'node/' . $item['node']->nid);
-  }  
+  }
   return theme('item_list', array('items' => $list, 'title' => $variables['title']));
 }
 
 function theme_submenu_tree_teasers($variables) {
   $output = '';
   if (isset($variables['title']))
-    $output .= '<h3>'. $variables['title'] .'</h3>';
+    $output .= '<h3>' . $variables['title'] . '</h3>';
   if (!empty($variables['links'])) {
     foreach ($variables['items'] as $item) {
       $output .= drupal_render(node_view($item['node'], 'teaser'));
@@ -523,7 +663,7 @@ function theme_submenu_tree_teasers($variables) {
 function theme_submenu_tree_fulltext($variables) {
   $output = '';
   if (isset($variables['title']))
-    $output .= '<h3>'. $variables['title'] .'</h3>';
+    $output .= '<h3>' . $variables['title'] . '</h3>';
   if (!empty($variables['links'])) {
     foreach ($variables['items'] as $item) {
       $output .= drupal_render(node_view($item['node'], 'full'));
