diff --git a/ldapauth.install b/ldapauth.install
index 61105b8..9d9ca62 100644
--- a/ldapauth.install
+++ b/ldapauth.install
@@ -114,7 +114,20 @@ function ldapauth_schema() {
     'indexes' => array(
       'sid' => array('sid'),
     ),
-    'primary key' => array('name')
+    'primary key' => array('name'),
+		'export' => array(
+      'key' => 'name',
+      'key name' => 'Name',
+      'primary key' => 'sid',
+      'identifier' => 'ldapauth_server',
+      'default hook' => 'default_ldapauth_server',
+      'api' => array(
+        'owner' => 'ldapauth',
+        'api' => 'default_ldapauth_servers',
+        'minimum_version' => 1,
+        'current_version' => 1,
+      ),
+    ),
   );
   return $schema;
 }
diff --git a/ldapdata.install b/ldapdata.install
index c6d8e4d..9c041da 100644
--- a/ldapdata.install
+++ b/ldapdata.install
@@ -15,34 +15,11 @@ function ldapdata_install() {
   // We're adding to an existing table, not creating a new one.
   $ret = array();
 
-  db_add_field($ret, 'ldapauth', 'ldapdata_binddn', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_bindpw', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_rwattrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_roattrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_mappings', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_attrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_filter_php', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+	$schema['ldapauth'] = array('fields' => array());
+  ldapdata_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_add_field($ret, 'ldapauth', $name, $spec);
+  }
 
   return $ret;
 }
@@ -54,13 +31,11 @@ function ldapdata_uninstall() {
   // We're removing fileds from an existing table, not deleting a whole one.
   $ret = array();
 
-  db_drop_field($ret, 'ldapauth', 'ldapdata_binddn');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_bindpw');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_rwattrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_roattrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_mappings');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_attrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_filter_php');
+	$schema['ldapauth'] = array('fields' => array());
+  ldapdata_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_drop_field($ret, 'ldapauth', $name);
+  }
 
   // Remove variables
   variable_del('ldapdata_sync');
@@ -68,16 +43,56 @@ function ldapdata_uninstall() {
   return $ret;
 }
 
+/**
+ * Implementation of hook_schema_alter().
+ */
+function ldapdata_schema_alter(&$schema) {
+	if (isset($schema['ldapauth'])) {
+		$schema['ldapauth']['fields'] += array(
+			'ldapdata_binddn' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapdata_bindpw' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapdata_rwattrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_roattrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_mappings' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_attrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_filter_php' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+		);
+	}
+}
+
 function ldapdata_update_6001() {
   $ret = array();
-  db_add_field($ret, 'ldapauth', 'ldapdata_attrs',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_filter_php',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  return $ret;
-}
+	$new_fields = array(
+		'ldapdata_attrs',
+		'ldapdata_filter_php',
+	);
 
+	$schema['ldapauth'] = array('fields' => array());
+  ldapdata_schema_alter($schema);
+  foreach ($new_fields as $name) {
+    db_add_field($ret, 'ldapauth', $name, $schema['ldapauth']['fields'][$name]);
+  }
+
+  return $ret;
+}
\ No newline at end of file
diff --git a/ldapgroups.install b/ldapgroups.install
index d499109..07bddfb 100644
--- a/ldapgroups.install
+++ b/ldapgroups.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * ldapfroups module installation and upgrade code.
+ * ldapgroups module installation and upgrade code.
  */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -15,57 +15,11 @@ function ldapgroups_install() {
   // We're adding to an existing table, not creating a new one.
   $ret = array();
 
-  db_add_field($ret, 'ldapauth', 'ldapgroups_in_dn', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_dn_attribute', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_attr', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_in_attr', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_as_entries', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_entries', array(
-    'type' => 'text',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_entries_attribute',  array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+  $schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_add_field($ret, 'ldapauth', $name, $spec);
+  }
 
   return $ret;
 }
@@ -77,41 +31,93 @@ function ldapgroups_uninstall() {
   // We're removing fileds from an existing table, not deleting a whole one.
   $ret = array();
 
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_dn');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_dn_attribute');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_attr');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_attr');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_as_entries');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries_attribute');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings_filter');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_filter_php');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_groups');
+  $schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_drop_field($ret, 'ldapauth', $name);
+  }
 
   return $ret;
 }
 
-function ldapgroups_update_6001() {
-  $ret = array();
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  return $ret;
+/**
+ * Implementation of hook_schema_alter().
+ */
+function ldapgroups_schema_alter(&$schema) {
+	if (isset($schema['ldapauth'])) {
+		$schema['ldapauth']['fields'] += array(
+			'ldapgroups_in_dn' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_dn_attribute' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_attr' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_in_attr' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_as_entries' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_entries' => array(
+				'type' => 'text',
+			),
+			'ldapgroups_entries_attribute' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_mappings' =>  array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapgroups_mappings_filter' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_filter_php' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapgroups_groups' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+		);
+	}
 }
 
+/**
+ * Implementation of hook_update_N().
+ */
+function ldapgroups_update_6001() {
+	$ret = array();
+	$new_fields = array(
+		'ldapgroups_mappings',
+		'ldapgroups_mappings_filter',
+		'ldapgroups_filter_php',
+		'ldapgroups_groups'
+	);
+
+	$schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($new_fields as $name) {
+    db_add_field($ret, 'ldapauth', $name, $schema['ldapauth']['fields'][$name]);
+  }
+
+  return $ret;
+}
\ No newline at end of file
