diff --git a/profile2_regpath.info b/profile2_regpath.info
index 0b7c81b..66921f5 100755
--- a/profile2_regpath.info
+++ b/profile2_regpath.info
@@ -1,5 +1,6 @@
 name = Profile2 Registration Path
 description = Attach profile2 profile forms to profile-specific registration urls.
 core = 7.x
+dependencies[] = ctools
 dependencies[] = profile2
-files[] = profile2_regpath.test
\ No newline at end of file
+files[] = profile2_regpath.test
diff --git a/profile2_regpath.install b/profile2_regpath.install
index 6d331ea..66277f5 100755
--- a/profile2_regpath.install
+++ b/profile2_regpath.install
@@ -11,11 +11,31 @@
 function profile2_regpath_schema() {
   $schema['profile2_regpath'] = array(
     'description' => 'Stores registration path information for profile2 profiles',
+    'export' => array(
+      'key' => 'profile_type',
+      'key name' => 'Profile Type',
+      'primary key' => 'profile_type',
+      'identifier' => 'regpath', // Exports will be defined as $regpath
+      'api' => array(
+        'owner' => 'profile2_regpath',
+        'api' => 'profile2_regpath',
+        'minimum_version' => '1',
+        'current_version' => '1',
+      ),
+    ),
     'fields' => array(
+      'profile_type' => array(
+        'description' => 'The {profile_type}.type of this profile.',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
       'profile_id' => array(
         'description' => 'Profile2 profile ID',
         'type' => 'int',
         'not null' => TRUE,
+        'no export' => TRUE, // Do not export database-only keys.
       ),
       'path' => array(
         'description' => 'Profile-specific registration form path',
@@ -48,7 +68,7 @@ function profile2_regpath_schema() {
         'not null' => FALSE,
       ),
     ),
-    'primary key' => array('profile_id'),
+    'primary key' => array('profile_type'),
     'indexes' => array(
       'type' => array(array('path', 255)),
     ),
@@ -138,4 +158,66 @@ function profile2_regpath_update_7130() {
       module_disable(array('profile2_regpath'));
     }
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Implements hook_update_n().
+ *
+ * Add fields
+ */
+function profile2_regpath_update_7131() {
+  $spec = array(
+    'description' => 'The {profile_type}.type of this profile.',
+    'type' => 'varchar',
+    'length' => '255',
+    'not null' => TRUE,
+    'default' => '',
+  );
+  db_add_field('profile2_regpath', 'profile_type', $spec);
+  db_add_index('profile2_regpath', 'profile_type', array('profile_type'));
+  db_drop_index('profile2_regpath', 'profile_id');
+}
+
+/**
+ * Implements hook_update_n().
+ *
+ * Update roles
+ */
+function profile2_regpath_update_7132() {
+  $query = db_select('profile2_regpath', 'pr');
+  $query->fields('pr', array('roles', 'profile_id'));
+  $result = $query->execute();
+  $regpaths = $result->fetchAll();
+
+  // Only store role that is enabled.
+  // Use role name instead of role id
+  foreach ($regpaths as $regpath) {
+    $roles = unserialize($regpath->roles);
+    $updated_roles = array();
+    foreach ($roles as $role_id => $enable) {
+      if ($enable) {
+        $updated_roles[$role_id] = db_query("SELECT r.name FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
+      }
+    }
+
+    // Update roles
+    db_update('profile2_regpath')
+            ->fields(array('roles' => serialize($updated_roles)))
+            ->condition('profile_id', $regpath->profile_id)
+            ->execute();
+  }
+}
+
+/**
+ * Implements hook_update_n().
+ *
+ * Update profile name
+ */
+function profile2_regpath_update_7133() {
+  db_query(
+    'UPDATE {profile2_regpath} AS pr ' .
+    'JOIN {profile_type} AS pt ' .
+    'ON pr.profile_id = pt.id ' .
+    'SET pr.profile_type = pt.type '
+  );
+}
diff --git a/profile2_regpath.module b/profile2_regpath.module
index a3de021..3be95bb 100755
--- a/profile2_regpath.module
+++ b/profile2_regpath.module
@@ -14,72 +14,71 @@
 function profile2_regpath_menu() {
   $items = array();
 
-  $reg_paths = profile2_regpath_get_reg_paths();
+  $reg_paths = profile2_regpath_regpath_load_all();
   if ($reg_paths) {
     // Set menu items for each registration path.
-    foreach ($reg_paths as $key => $value) {
-      $path = $value->path;
-      if ($profile_types = profile2_regpath_get_profiles($path)) {
-        // Add profile-specific administrative 'add user' page.
-        $items['admin/people/p2rp-create/' . $path] = array(
-          'title' => 'Add user (' . $profile_types[0]->label . ' profile)',
+    foreach ($reg_paths as $reg_path) {
+      $path = $reg_path->path;
+
+      // Add profile-specific administrative 'add user' page.
+      $items['admin/people/p2rp-create/' . $path] = array(
+        'title' => 'Add user (' . profile2_regpath_get_profile_label($reg_path->profile_type) . ' profile)',
+        'page callback' => '_profile2_regpath_user_register',
+        'page arguments' => array(
+          'regpath' => $reg_path,
+        ),
+        'access arguments' => array('administer users'),
+        'type' => MENU_LOCAL_ACTION,
+        'file' => 'registration_form.inc',
+      );
+
+      // Create registration pages for each profile type.
+      // We will use hook_menu_alter() to deal with the 'user/' path later.
+      if ($path != 'user') {
+        $registration_path = $path . '/register';
+
+        $items[$registration_path] = array(
+          'title' => 'Create new account',
           'page callback' => '_profile2_regpath_user_register',
           'page arguments' => array(
-            'profiles' => $profile_types,
+            'regpath' => $reg_path,
           ),
-          'access arguments' => array('administer users'),
-          'type' => MENU_LOCAL_ACTION,
+          'access callback' => 'user_is_anonymous',
           'file' => 'registration_form.inc',
+          'type' => MENU_LOCAL_TASK,
+        );
+        $items[$path] = array(
+          'title' => 'Log in',
+          'page callback' => '_profile2_regpath_user_login',
+          'page arguments' => array(
+            'regpath' => $reg_path,
+          ),
+          'access callback' => 'user_is_anonymous',
+          'file' => 'registration_form.inc',
+          'menu_name' => 'user-menu',
+          'type' => MENU_CALLBACK,
+        );
+        $items[$path . '/login'] = array(
+          'title' => 'Log in',
+          'page callback' => '_profile2_regpath_user_login',
+          'page arguments' => array(
+            'regpath' => $reg_path,
+          ),
+          'access callback' => 'user_is_anonymous',
+          'file' => 'registration_form.inc',
+          'type' => MENU_DEFAULT_LOCAL_TASK,
         );
 
-        // Create registration pages for each profile type.
-        // We will use hook_menu_alter() to deal with the 'user/' path later.
-        if ($path != 'user') {
-          $registration_path = $path . '/register';
-
-          $items[$registration_path] = array(
-            'title' => 'Create new account',
-            'page callback' => '_profile2_regpath_user_register',
-            'page arguments' => array(
-              'profiles' => $profile_types,
-            ),
-            'access callback' => 'user_is_anonymous',
-            'file' => 'registration_form.inc',
-            'type' => MENU_LOCAL_TASK,
-          );
-          $items[$path] = array(
-            'title' => 'Log in',
-            'page callback' => '_profile2_regpath_user_login',
-            'page arguments' => array(
-              'profiles' => $profile_types,
-            ),
-            'access callback' => 'user_is_anonymous',
-            'file' => 'registration_form.inc',
-            'menu_name' => 'user-menu',
-            'type' => MENU_CALLBACK,
-          );
-          $items[$path . '/login'] = array(
-            'title' => 'Log in',
-            'page callback' => '_profile2_regpath_user_login',
-            'page arguments' => array(
-              'profiles' => $profile_types,
-            ),
-            'access callback' => 'user_is_anonymous',
-            'file' => 'registration_form.inc',
-            'type' => MENU_DEFAULT_LOCAL_TASK,
-          );
-
-          $items[$path . '/password'] = array(
-            'title' => 'Request new password',
-            'type' => MENU_LOCAL_TASK,
-            'page callback' => '_profile2_regpath_user_password',
-            'page arguments' => array(
-              'profiles' => $profile_types,
-            ),
-            'access callback' => 'user_is_anonymous',
-            'file' => 'registration_form.inc',
-          );
-        }
+        $items[$path . '/password'] = array(
+          'title' => 'Request new password',
+          'type' => MENU_LOCAL_TASK,
+          'page callback' => '_profile2_regpath_user_password',
+          'page arguments' => array(
+            'regpath' => $reg_path,
+          ),
+          'access callback' => 'user_is_anonymous',
+          'file' => 'registration_form.inc',
+        );
       }
     }
   }
@@ -91,10 +90,11 @@ function profile2_regpath_menu() {
  */
 function profile2_regpath_menu_alter(&$items) {
   // Check to see if the default 'user' path is being used with Profile2.
-  if ($user_paths = profile2_regpath_get_profiles('user')) {
+  if ($user_paths = profile2_regpath_regpath_load_multiple(array('path' => 'user'))) {
+    $regpath = array_shift($user_paths);
     // Build form at user/register using _profile2_regpath_user_register().
     $items['user/register']['page callback'] = '_profile2_regpath_user_register';
-    $items['user/register']['page arguments'] = array('profiles' => $user_paths);
+    $items['user/register']['page arguments'] = array('regpath' => $regpath);
     $items['user/register']['file'] = 'registration_form.inc';
     $items['user/register']['file path'] = drupal_get_path('module', 'profile2_regpath');
 
@@ -124,8 +124,7 @@ function profile2_regpath_form_profile2_type_form_alter(&$form, &$form_state, $f
     // Grab existing values.
     global $base_url;
     $profile_type = $form['type']['#default_value'];
-    $profile_id   = profile2_regpath_get_profile_id($profile_type);
-    $settings     = db_query("SELECT * FROM {profile2_regpath} WHERE profile_id = :profile_id", array(':profile_id' => $profile_id))->fetch();
+    $settings     = profile2_regpath_regpath_load($profile_type);
     // Unserialize array of miscellaneous display options.
     if (is_object($settings)) {
       $misc = unserialize($settings->misc);
@@ -238,12 +237,25 @@ function profile2_regpath_form_profile2_type_form_alter(&$form, &$form_state, $f
     $roles = user_roles(TRUE);
     unset($roles[DRUPAL_AUTHENTICATED_RID]);
 
+    // Prepare default value for roles checkbox
+    $default_roles = array();
+    $roles_settings = is_object($settings) && $settings->roles ? unserialize($settings->roles) : array();
+    $enabled_rids = array_keys($roles_settings);
+    foreach ($roles as $rid => $role_name) {
+      // Check by rid, not role name
+      if (in_array($rid, $enabled_rids)) {
+        $default_roles[$rid] = $rid;
+      } else {
+        $default_roles[$rid] = 0;
+      }
+    }
+
     $form['regpath']['settings']['roles'] = array(
       '#type' => 'checkboxes',
       '#title' => t('Assign roles during registration'),
       '#description' => t('Please select any roles that you would like to automatically assign to users registering via this registration path.'),
       '#options' => $roles,
-      '#default_value' => is_object($settings) && $settings->roles ? unserialize($settings->roles) : array(),
+      '#default_value' => $default_roles,
     );
 
     $form['regpath']['settings']['weight'] = array(
@@ -365,7 +377,15 @@ function profile2_regpath_save_settings($form, &$form_state) {
   );
 
   // Add roles if enabled.
-  $fields['roles'] = serialize($form_state['values']['roles']);
+  // Use role name instead of role id
+  $roles = array();
+  foreach ($form_state['values']['roles'] as $role_id => $enable) {
+    if ($enable) {
+      $roles[$role_id] = db_query("SELECT r.name FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
+    }
+  }
+  $fields['roles'] = serialize($roles);
+
   // Create array of miscellaneous display options.
   $fields['misc'] = serialize(array(
       'fieldset_wrap' => $form_state['values']['fieldset_wrap'],
@@ -378,7 +398,9 @@ function profile2_regpath_save_settings($form, &$form_state) {
     ));
 
   // Add settings to database.
-  db_merge('profile2_regpath')->key(array('profile_id' => $profile_id))->fields($fields)->execute();
+  $fields['profile_type'] = $profile_type;
+  $fields['profile_id'] = $profile_id;
+  profile2_regpath_regpath_save($fields);
 
   // Build array of form elements to check for new values.
   $changed_check = array(
@@ -428,7 +450,7 @@ function profile2_regpath_form_alter(&$form, &$form_state, $form_id) {
     $url = drupal_parse_url($form['#action']);
     $path = explode('/', str_replace('/register', '', $url['path']));
     $path_key = end($path);
-    $profile_types = profile2_regpath_get_profiles($path_key);
+    $profile_types = profile2_regpath_regpath_load_multiple(array('path' => $path_key));
     profile2_regpath_attach_profile_fields($form, $form_state, $form_id, $profile_types);
   }
 }
@@ -445,19 +467,15 @@ function profile2_regpath_attach_profile_fields(&$form, &$form_state, $form_id,
     $url = drupal_parse_url($form['#action']);
     $path = explode('/', str_replace('/register', '', $url['path']));
     $path_key = end($path);
-    $profile_types = profile2_regpath_get_profiles($path);
+    $profile_types = profile2_regpath_regpath_load_multiple(array('path' => $path_key));
   }
 
   if ($profile_types != NULL) {
 
-    // Prepare variables for roles.
-    $user_roles = user_roles(TRUE);
-    $roles = array();
-
     // Attach profile(s) to user/register form.
     foreach ($profile_types as $key => $value) {
       // Get profile object.
-      $type_name = (string) $profile_types[$key]->type;
+      $type_name = (string) $profile_types[$key]->profile_type;
       $profile_type = profile2_get_types($type_name);
 
       // If this profile has not already been attached.
@@ -470,7 +488,7 @@ function profile2_regpath_attach_profile_fields(&$form, &$form_state, $form_id,
           // Wrap each profile form in a fieldset.
           $form['profile_' . $type_name] = array(
             '#type' => 'fieldset',
-            '#title' => check_plain($profile_type->label),
+            '#title' => check_plain(profile2_regpath_get_profile_label($profile_types[$key]->profile_type)),
           );
         }
         // Set Form API #weight attribute for profile.
@@ -484,12 +502,12 @@ function profile2_regpath_attach_profile_fields(&$form, &$form_state, $form_id,
 
       // Add appropriate user roles.
       $profile_roles = unserialize($value->roles);
-      foreach ($profile_roles as $rid => $value) {
+      foreach ($profile_roles as $rid => $role_name) {
         // Add role to roles array if it isn't already there.
-        if ($value != 0 && !array_key_exists($rid, $form['account']['roles'])) {
+        if (!array_key_exists($rid, $form['account']['roles'])) {
           $form['account']['roles'][$rid] = array(
             '#type' => 'checkbox',
-            '#title' => check_plain($user_roles[$rid]),
+            '#title' => $role_name,
             '#default_value' => TRUE,
             '#disabled' => (user_access('administer users') ? FALSE : TRUE),
           );
@@ -529,56 +547,119 @@ function profile2_regpath_get_profile_id($profile_type) {
 }
 
 /**
- * Returns object containing all p2rp data.
+ * Provides label by profile machine_name.
  *
- * @param string $path
- *   (optional) path value for WHERE condition. Defaults to NULL.
- *
- * @param string $groupby
- *   (optional) field to groupby. Defaults to NULL.
+ * @param string $profile_type
+ *   Machine-name of profile2 profile type.
  *
- * @return object
- *   An object containing all matching profile2 registration path enabled
- *   profile types.
+ * @return string
+ *   The label for indicated profile type.
  */
-function profile2_regpath_get_profiles($path = NULL, $groupby = NULL, $pid = NULL) {
-  // Get data object of all registration paths.
-  $query = db_select('profile2_regpath', 'pr');
-  $query->join('profile_type', 'pt', 'pr.profile_id = pt.id');
-  $query->fields('pr', array('path', 'roles', 'misc', 'status'));
-  $query->fields('pt', array('id', 'label', 'type'));
-  if ($path) {
-    $query->condition('path', $path);
-  }
-  if ($groupby) {
-    $query->groupBy($groupby);
-  }
-  if ($pid) {
-    $query->condition('profile_id', $pid);
+function profile2_regpath_get_profile_label($profile_type) {
+  $profile_label = db_query("SELECT label FROM {profile_type} WHERE type = :profile_type", array(':profile_type' => $profile_type))->fetchField();
+  return $profile_label;
+}
+
+/**
+ * Implements 'load' callback for regpath exportables.
+ */
+function profile2_regpath_regpath_load($profile_type) {
+  // Prevent "Call to undefined function ctools_include()" error while going to profile manage page
+  module_load_include('module', 'ctools', 'ctools');
+
+  ctools_include('export');
+  $result = ctools_export_load_object('profile2_regpath', 'names', array($profile_type));
+  if (isset($result[$profile_type])) {
+    return $result[$profile_type];
   }
-  $query->condition('pr.status', 1);
-  $query->orderBy('pr.weight', 'ASC');
-  $result = $query->execute();
-  $profile_types = $result->fetchAll();
+}
+
+/**
+ * Implements 'load multiple' callback for regpath exportables.
+ */
+function profile2_regpath_regpath_load_multiple($conditions) {
+  // Prevent "Call to undefined function ctools_include()" error
+  module_load_include('module', 'ctools', 'ctools');
 
-  return $profile_types;
+  ctools_include('export');
+  $results = ctools_export_load_object('profile2_regpath', 'conditions', $conditions);
+  return array_filter($results);
 }
 
 /**
- * Returns object containing all p2rp registration paths.
+ * Implements 'load all' callback for regpath exportables.
+ */
+function profile2_regpath_regpath_load_all() {
+  // Prevent "Call to undefined function ctools_include()" error while updating database
+  module_load_include('module', 'ctools', 'ctools');
+
+  ctools_include('export');
+  $results = ctools_export_load_object('profile2_regpath');
+  return array_filter($results);
+}
+
+/**
+ * Save a single regpath.
+ */
+function profile2_regpath_regpath_save(&$regpath) {
+  $exist = profile2_regpath_regpath_load($regpath['profile_type']);
+  $update = $exist ? 'profile_type' : array();
+
+  return db_merge('profile2_regpath')->key(array('profile_type' => $regpath['profile_type']))->fields($regpath)->execute();
+  //return drupal_write_record('profile2_regpath', $regpath, $update);
+}
+
+/**
+* Delete a regpath.
+*/
+function profile2_regpath_regpath_delete($regpath) {
+  // Prevent "Call to undefined function ctools_include()" error
+  module_load_include('module', 'ctools', 'ctools');
+
+  $profile_type = is_object($regpath) ? $regpath->profile_type : $regpath;
+  db_query('DELETE FROM {profile2_regpath} WHERE profile_type=:profile_type', array(':profile_type' => $profile_type));
+
+  // Clear the Ctools export API cache.
+  ctools_include('export');
+  ctools_export_load_object_reset('profile2_regpath');
+}
+
+/**
+ * Implements hook_features_revert().
+ * Rebuild menu after all profile2_regpath components is reverted.
  *
- * @return array
- *   An array containing all active registration paths & path types.
+ * @param type $module_namestring $module_name
+ *   The name of the feature module whose components should be reverted.
  */
-function profile2_regpath_get_reg_paths() {
-  $reg_paths = NULL;
-  // Get data object of all registration paths.
-  $query = db_select('profile2_regpath', 'pr');
-  $query->fields('pr', array('path', 'misc'));
-  $query->groupBy('path');
-  $query->condition('pr.status', 1);
-  $result = $query->execute();
-  $reg_paths = $result->fetchAll();
-
-  return $reg_paths;
+function profile2_regpath_features_revert($module_name) {
+  $regpaths = module_invoke($module_name, 'default_profile2_regpath');
+  if (!empty($regpaths)) {
+    foreach ($regpaths as $regpath) {
+      profile2_regpath_regpath_delete($regpath);
+    }
+  }
+  menu_rebuild();
+}
+
+/**
+ * Implements hook_features_rebuild().
+ * Rebuild menu after all profile2_regpath components is re-built.
+ *
+ * @todo I don't know how to rebuild a feature by hand, so I can't test this.
+ *
+ * @param string $module_name
+ *   The name of the feature module whose components should be rebuilt.
+ */
+function hook_features_rebuild($module_name) {
+  $regpaths = module_invoke($module_name, 'default_profile2_regpath');
+  if (!empty($regpaths)) {
+    foreach ($regpaths as $regpath) {
+      // Disable non-schema properties
+      unset($regpath->disabled);
+      unset($regpath->api_version);
+      $regpath = get_object_vars($regpath);
+      profile2_regpath_regpath_save($regpath);
+    }
+  }
+  menu_rebuild();
 }
diff --git a/registration_form.inc b/registration_form.inc
index f792471..53457c7 100755
--- a/registration_form.inc
+++ b/registration_form.inc
@@ -16,10 +16,10 @@
  *
  * @see profile2_regpath_menu()
  */
-function _profile2_regpath_user_login($profiles) {
+function _profile2_regpath_user_login($regpath) {
   module_load_include('pages.inc', 'user', 'user');
   $output = user_page();
-  _profile2_regpath_set_title($profiles, 'login_title');
+  _profile2_regpath_set_title($regpath, 'login_title');
   return $output;
 }
 
@@ -34,10 +34,10 @@ function _profile2_regpath_user_login($profiles) {
  *
  * @see profile2_regpath_menu()
  */
-function _profile2_regpath_user_register($profiles) {
+function _profile2_regpath_user_register($regpath) {
   module_load_include('pages.inc', 'user', 'user');
   $output = drupal_get_form('user_register_form');
-  _profile2_regpath_set_title($profiles, 'register_title');
+  _profile2_regpath_set_title($regpath, 'register_title');
   return $output;
 }
 
@@ -52,10 +52,10 @@ function _profile2_regpath_user_register($profiles) {
  *
  * @see profile2_regpath_menu()
  */
-function _profile2_regpath_user_password($profiles) {
+function _profile2_regpath_user_password($regpath) {
   module_load_include('pages.inc', 'user', 'user');
   $output = drupal_get_form('user_pass');
-  _profile2_regpath_set_title($profiles, 'password_title');
+  _profile2_regpath_set_title($regpath, 'password_title');
   return $output;
 }
 
@@ -69,9 +69,9 @@ function _profile2_regpath_user_password($profiles) {
  * @param string $key
  *   Array key for 'misc' array. This will determine the title settings.
  */
-function _profile2_regpath_set_title($profiles, $key) {
+function _profile2_regpath_set_title($regpath, $key) {
   // Look for custom title in foremost profile, according to weight.
-  if (isset($profiles[0]->misc) && $misc = unserialize($profiles[0]->misc)) {
+  if (isset($regpath->misc) && $misc = unserialize($regpath->misc)) {
     if (array_key_exists($key, $misc)) {
       $title = $misc[$key];
     }
