diff --git a/nodeapi_example/nodeapi_example.install b/nodeapi_example/nodeapi_example.install
index 7abfc01..7177f4c 100644
--- a/nodeapi_example/nodeapi_example.install
+++ b/nodeapi_example/nodeapi_example.install
@@ -7,6 +7,8 @@
 
 /**
  * Implements hook_schema().
+ *
+ * @ingroup nodeapi_example
  */
 function nodeapi_example_schema() {
   $schema['nodeapi_example'] = array(
@@ -42,3 +44,39 @@ function nodeapi_example_schema() {
 
   return $schema;
 }
+
+/**
+ * Implements hook_uninstall().
+ *
+ * We need to clean up our variables data when uninstalling
+ * our module.
+ *
+ * Our implementation of nodeapi_example_form_alter() automatically
+ * created a nodeapi_example_node_type_<contentType> variable
+ * for each node type the user wants to rate.
+ *
+ * To delete our variables we call variable_del for our variables'
+ * namespace, 'nodeapi_example_'. Note that an average module would have
+ * known variables that it had created, and it could just delete those
+ * explicitly. For example, see render_example_uninstall(). It's important
+ * not to delete variables that might be owned by other modules, so normally
+ * we would just explicitly delete a set of known variables.
+ *
+ * hook_uninstall() will only be called when uninstalling a module,
+ * not when disabling a module. This allows our data to say in the
+ * database if the user only disables our module without uninstalling
+ * it.
+ *
+ * @ingroup nodeapi_example
+ */
+function nodeapi_example_uninstall() {
+  // Simple DB query to get the names of our variables.
+  $results = db_select('variable', 'v')
+    ->fields('v', array('name'))
+    ->condition('name', 'nodeapi_example_node_type_%', 'LIKE')
+    ->execute();
+  // Loop through and delete each of our variables.
+  foreach ($results as $result) {
+    variable_del($result->name);
+  }
+}
diff --git a/nodeapi_example/nodeapi_example.module b/nodeapi_example/nodeapi_example.module
index 697550b..34b9f79 100755
--- a/nodeapi_example/nodeapi_example.module
+++ b/nodeapi_example/nodeapi_example.module
@@ -41,11 +41,14 @@ function nodeapi_example_form_alter(&$form, $form_state, $form_id) {
       '#weight' => -1,
     );
 
-    $form['rating']['nodeapi_example'] = array(
+    $form['rating']['nodeapi_example_node_type'] = array(
       '#type' => 'radios',
       '#title' => t('NodeAPI Example Rating'),
-      '#default_value' => variable_get('nodeapi_example_' . $form['#node_type']->type, FALSE),
-      '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
+      '#default_value' => variable_get('nodeapi_example_node_type_' . $form['#node_type']->type, FALSE),
+      '#options' => array(
+        FALSE => t('Disabled'),
+        TRUE => t('Enabled')
+      ),
       '#description' => t('Should this node have a rating attached to it?'),
     );
   }
@@ -55,7 +58,7 @@ function nodeapi_example_form_alter(&$form, $form_state, $form_id) {
     // If the rating is enabled for this node type, we insert our control
     // into the form.
     $node = $form['#node'];
-    if (variable_get('nodeapi_example_' . $form['type']['#value'], FALSE)) {
+    if (variable_get('nodeapi_example_node_type_' . $form['type']['#value'], FALSE)) {
       $form['nodeapi_example_rating'] = array(
         '#type' => 'select',
         '#title' => t('Rating'),
@@ -110,7 +113,7 @@ function nodeapi_example_form_alter(&$form, $form_state, $form_id) {
  * field is required. If not, send error message.
  */
 function nodeapi_example_node_validate($node, $form) {
-  if (variable_get('nodeapi_example_' . $node->type, FALSE)) {
+  if (variable_get('nodeapi_example_node_type_' . $node->type, FALSE)) {
     if (isset($node->nodeapi_example_rating) && !$node->nodeapi_example_rating) {
       form_set_error('nodeapi_example_rating', t('You must rate this content.'));
     }
@@ -127,7 +130,7 @@ function nodeapi_example_node_load($nodes, $types) {
   // We can use $types to figure out if we need to process any of these nodes.
   $our_types = array();
   foreach ($types as $type) {
-    if (variable_get('nodeapi_example_' . $type, FALSE)) {
+    if (variable_get('nodeapi_example_node_type_' . $type, FALSE)) {
       $our_types[] = $type;
     }
   }
@@ -141,7 +144,7 @@ function nodeapi_example_node_load($nodes, $types) {
   // Now we need to make a list of revisions based on $our_types
   foreach ($nodes as $node) {
     // We are using the revision id instead of node id.
-    if (variable_get('nodeapi_example_' . $node->type, FALSE)) {
+    if (variable_get('nodeapi_example_node_type_' . $node->type, FALSE)) {
       $vids[] = $node->vid;
     }
   }
@@ -169,7 +172,7 @@ function nodeapi_example_node_load($nodes, $types) {
  * database inserts.
  */
 function nodeapi_example_node_insert($node) {
-  if (variable_get('nodeapi_example_' . $node->type, FALSE)) {
+  if (variable_get('nodeapi_example_node_type_' . $node->type, FALSE)) {
     // Notice that we are ignoring any revision information using $node->nid
     db_insert('nodeapi_example')
     ->fields(array(
@@ -206,7 +209,7 @@ function nodeapi_example_node_delete($node) {
  * we update it. Otherwise, we call nodeapi_example_node_insert() to create one.
  */
 function nodeapi_example_node_update($node) {
-  if (variable_get('nodeapi_example_' . $node->type, FALSE)) {
+  if (variable_get('nodeapi_example_node_type_' . $node->type, FALSE)) {
     // Check first if this node has a saved rating.
     $rating = db_select('nodeapi_example', 'e')
       ->fields('e', array(
@@ -246,7 +249,7 @@ function nodeapi_example_node_update($node) {
  * with additional information.
  */
 function nodeapi_example_node_view($node, $build_mode = 'full') {
-  if (variable_get('nodeapi_example_' . $node->type, FALSE)) {
+  if (variable_get('nodeapi_example_node_type_' . $node->type, FALSE)) {
     // Make sure to set a rating, also for nodes saved previously and not yet rated.
     $rating = isset($node->nodeapi_example_rating) ? $node->nodeapi_example_rating : 0;
     $node->content['nodeapi_example'] = array(
diff --git a/nodeapi_example/nodeapi_example.test b/nodeapi_example/nodeapi_example.test
index 6518fae..d36d2eb 100644
--- a/nodeapi_example/nodeapi_example.test
+++ b/nodeapi_example/nodeapi_example.test
@@ -65,11 +65,11 @@ class NodeApiExampleTestCase extends DrupalWebTestCase {
 
     // Check if the new Rating options appear in the settings page
     $this->assertText(t('NodeAPI Example Rating'), t('Rating options found in content type.'));
-    $this->assertFieldByName('nodeapi_example', 1, t('Rating is Disabled by default.'));
+    $this->assertFieldByName('nodeapi_example_node_type', 1, t('Rating is Disabled by default.'));
 
     // Disable the rating for this content type: 0 for Disabled, 1 for Enabled.
     $content_settings = array(
-      'nodeapi_example' => 0,
+      'nodeapi_example_node_type' => 0,
     );
     $this->drupalPost('admin/structure/types/manage/' . $type, $content_settings, t('Save content type'));
     $this->assertResponse(200);
@@ -91,7 +91,7 @@ class NodeApiExampleTestCase extends DrupalWebTestCase {
 
     // Enable the rating for this content type: 0 for Disabled, 1 for Enabled.
     $content_settings = array(
-      'nodeapi_example' => TRUE,
+      'nodeapi_example_node_type' => TRUE,
     );
     $this->drupalPost('admin/structure/types/manage/' . $type, $content_settings, t('Save content type'));
     $this->assertResponse(200);
@@ -133,11 +133,11 @@ class NodeApiExampleTestCase extends DrupalWebTestCase {
 
     // Check if the new Rating options appear in the settings page
     $this->assertText(t('NodeAPI Example Rating'), t('Rating options found in content type.'));
-    $this->assertFieldByName('nodeapi_example', 1, t('Rating is Disabled by default.'));
+    $this->assertFieldByName('nodeapi_example_node_type', 1, t('Rating is Disabled by default.'));
 
     // Disable the rating for this content type: 0 for Disabled, 1 for Enabled.
     $content_settings = array(
-      'nodeapi_example' => 0,
+      'nodeapi_example_node_type' => 0,
     );
     $this->drupalPost('admin/structure/types/manage/' . $type, $content_settings, t('Save content type'));
     $this->assertResponse(200);
@@ -159,7 +159,7 @@ class NodeApiExampleTestCase extends DrupalWebTestCase {
 
     // Enable the rating for this content type: 0 for Disabled, 1 for Enabled.
     $content_settings = array(
-      'nodeapi_example' => TRUE,
+      'nodeapi_example_node_type' => TRUE,
     );
     $this->drupalPost('admin/structure/types/manage/' . $type, $content_settings, t('Save content type'));
     $this->assertResponse(200);
