diff --git a/entity_index.install b/entity_index.install
index 358957b..16a0b37 100644
--- a/entity_index.install
+++ b/entity_index.install
@@ -43,7 +43,7 @@ function entity_index_schema() {
 
   if ($entity_types = entity_index_enabled_entity_types()) {
     foreach ($entity_types as $entity_type) {
-      $schema["entity_index_{$entity_type}"] = array(
+        $schema["entity_index_{$entity_type}"] = array(
         'fields' => array(
           // Create an unused primary key field to avoid adding a lot of data
           // to the many other indexes that will be used.
diff --git a/entity_index.module b/entity_index.module
index 689003b..fa24e2e 100644
--- a/entity_index.module
+++ b/entity_index.module
@@ -221,3 +221,23 @@ function entity_index_views_api() {
     'api' => 3,
   );
 }
+
+/**
+ * Cleanup
+ */
+function entity_index_cleanup($entity_type = '') {
+  $test = NULL;
+
+  // The schema for that entity would not be available at this point because
+  // it is already disabled.
+  #$schema = drupal_get_schema_unprocessed("entity_index_{$entity_type}");
+  #_drupal_schema_initialize($schema, $module, FALSE);
+
+  #         $schema["entity_index_{$entity_type}"] = array(
+
+  // Remove entity table if it exists.
+  $table = "entity_index_{$entity_type}";
+  if (db_table_exists($table)) {
+    db_drop_table($table);
+  }
+}
