diff --git a/lib/Drupal/configuration/Config/Configuration.php b/lib/Drupal/configuration/Config/Configuration.php
index 631d963..1c873be 100644
--- a/lib/Drupal/configuration/Config/Configuration.php
+++ b/lib/Drupal/configuration/Config/Configuration.php
@@ -66,6 +66,11 @@ abstract class Configuration {
   protected $data;
 
   /**
+   * The set of this configuration. Sets are used to organize configurations.
+   */
+  protected $set;
+
+  /**
    * An array of configuration objects required to use this configuration.
    */
   protected $dependencies = array();
@@ -354,6 +359,7 @@ abstract class Configuration {
     // Save the configuration into a file.
     $this->storage
             ->setApiVersion(ConfigurationManagement::api)
+            ->setFileName($this->getFileName())
             ->setData($this->data)
             ->setKeysToExport($this->getKeysToExport())
             ->setDependencies(drupal_map_assoc(array_keys($this->getDependencies())))
@@ -407,6 +413,15 @@ abstract class Configuration {
     if (empty($this->broken)) {
       $this->findRequiredModules();
     }
+
+    if (isset($this->context)) {
+      if ($sets = $this->context->getSetting('sets')) {
+        if (!empty($sets[$this->getUniqueId()])) {
+          $this->setSet($sets[$this->getUniqueId()]);
+        }
+      }
+    }
+
     $this->built = TRUE;
     return $this;
   }
@@ -452,8 +467,10 @@ abstract class Configuration {
       $tracked = $tracking_file['tracked'];
     }
 
-    if (isset($tracked[$this->getUniqueId()])) {
-      $file_hash = $tracked[$this->getUniqueId()];
+    $filename = $this->getFileName();
+    $filename = substr($filename, 0, strrpos($filename, '.'));
+    if (isset($tracked[$filename])) {
+      $file_hash = $tracked[$filename];
     }
     if (!isset($file_hash)) {
       return $human_name ? t('ActiveStore only') : Configuration::notTracked;
@@ -557,6 +574,21 @@ abstract class Configuration {
   }
 
   /**
+   * Return the set for this configuration.
+   */
+  public function getSet() {
+    return $this->set;
+  }
+
+  /**
+   * Set the set for this configuration.
+   */
+  public function setSet($value) {
+    $this->set = $value;
+    return $this;
+  }
+
+  /**
    * Returns the name of the required_modules that provide this configuration.
    */
   public function getModules() {
@@ -723,7 +755,24 @@ abstract class Configuration {
    * @return string
    */
   public function getFileName() {
+    $filename = db_select('configuration_tracked', 'ct')
+                      ->fields('ct', array('file'))
+                      ->condition('component', $this->getComponent())
+                      ->condition('identifier', $this->getIdentifier())
+                      ->execute()
+                      ->fetchField();
+
+    // If the configuration is tracked, return the name saved in the tracking
+    // table.
+    if (!empty($filename)) {
+      return $filename;
+    }
+
     $storage_system = static::getStorageSystem($this->getComponent());
+    $set = $this->getSet();
+    if (!empty($set)) {
+      return $set . '/' . $this->getUniqueId() . $storage_system::getFileExtension();
+    }
     return $this->getUniqueId() . $storage_system::getFileExtension();
   }
 
diff --git a/lib/Drupal/configuration/Config/ConfigurationManagement.php b/lib/Drupal/configuration/Config/ConfigurationManagement.php
index 4c10ccc..9f073e7 100644
--- a/lib/Drupal/configuration/Config/ConfigurationManagement.php
+++ b/lib/Drupal/configuration/Config/ConfigurationManagement.php
@@ -75,9 +75,15 @@ class ConfigurationManagement {
    */
   static public function createConfigurationInstance($configuration_id) {
     list($component_name, $identifier) = explode('.', $configuration_id, 2);
+    $set = '';
+    if (strpos($component_name, '/') !== FALSE) {
+      list($set, $component_name) = explode('/', $component_name);
+    }
     $handler = static::getConfigurationHandler($component_name);
     if (!empty($handler)) {
-      return new $handler($identifier, $component_name);
+      $instance = new $handler($identifier, $component_name);
+      $instance->setSet($set);
+      return $instance;
     }
     else {
       throw new \Exception('There is no configuration handler for: ' . $configuration_id);
@@ -272,8 +278,13 @@ class ConfigurationManagement {
 
     foreach ($list as $component) {
       $part = explode('.', $component, 2);
-      if (empty($handlers[$part[0]])) {
-        $settings->addInfo('no_handler', $part[0]);
+      $expected_component = $part[0];
+      $pos = strpos($expected_component, '/');
+      if ($pos !== FALSE) {
+        $expected_component = substr($expected_component, $pos + 1);
+      }
+      if (empty($handlers[$expected_component])) {
+        $settings->addInfo('no_handler', $expected_component);
       }
       else {
         $config = static::createConfigurationInstance($component);
@@ -314,6 +325,16 @@ class ConfigurationManagement {
    *   configurations.
    */
   static public function exportToDataStore($list = array(), $export_dependencies = TRUE, $export_optionals = TRUE, $start_tracking = FALSE) {
+    $sets = array();
+    foreach ($list as $config) {
+      $set = '';
+      list($component_name, $identifier) = explode('.', $config, 2);
+      if (strpos($component_name, '/') !== FALSE) {
+        list($set, $component_name) = explode('/', $component_name);
+      }
+      $sets[$component_name . '.' . $identifier] = $set;
+    }
+
     $settings = new ConfigIteratorSettings(
       array(
         'build_callback' => 'build',
@@ -322,6 +343,7 @@ class ConfigurationManagement {
         'process_optionals' => $export_optionals,
         'settings' => array(
           'start_tracking' => $start_tracking,
+          'sets' => $sets,
         ),
         'info' => array(
           'modules' => array(),
@@ -367,16 +389,19 @@ class ConfigurationManagement {
    *       'content_type' => array(
    *         'article' => array(
    *           'hash' => 'c08223610b3eb55161d4539c704e40989dcf3e72',
+   *           'file' => 'content_type.article.inc'
    *           'name' => 'Article',
    *         ),
    *         'page' => array(
    *           'hash' => '5161d4539c704e40989dcf3e72c08223610b3eb5',
+   *           'file' => 'content_type.page.inc'
    *           'name' => 'Page',
    *         ),
    *       ),
    *       'variable' => array(
    *         'site_name' => array(
    *           'hash' => '539c704e40989dcf35161d4e72c08223610b3eb5',
+   *           'file' => 'variable.site_name.inc'
    *           'name' => 'site_name',
    *         ),
    *       )
@@ -387,14 +412,17 @@ class ConfigurationManagement {
    *     array(
    *       'content_type.article' => array(
    *         'hash' => 'c08223610b3eb55161d4539c704e40989dcf3e72',
+   *         'file' => 'content_type.article.inc'
    *         'name' => 'Article',
    *       ),
    *       'content_type.page' => array(
    *         'hash' => '5161d4539c704e40989dcf3e72c08223610b3eb5',
+   *         'file' => 'content_type.page.inc'
    *         'name' => 'Page',
    *       ),
    *       'variable.site_name' => array(
    *         'hash' =>'539c704e40989dcf35161d4e72c08223610b3eb5',
+   *         'file' => 'variable.site_name.inc'
    *         'name' => 'site_name'
    *       )
    *     );
@@ -402,7 +430,7 @@ class ConfigurationManagement {
    */
   static public function trackedConfigurations($tree = TRUE) {
     $tracked = db_select('configuration_tracked', 'ct')
-                  ->fields('ct', array('component', 'identifier', 'hash'))
+                  ->fields('ct', array('component', 'identifier', 'hash', 'file'))
                   ->execute()
                   ->fetchAll();
 
@@ -432,12 +460,14 @@ class ConfigurationManagement {
         if ($tree) {
           $return[$object->component][$object->identifier] = array(
             'hash' => $object->hash,
+            'file' => $object->file,
             'name' => $name,
           );
         }
         else {
           $return[$object->component . '.' . $object->identifier] = array(
             'hash' => $object->hash,
+            'file' => $object->file,
             'name' => $name,
           );
         }
@@ -519,9 +549,10 @@ class ConfigurationManagement {
     $file = array();
     foreach ($tracked as $component => $list) {
       foreach ($list as $identifier => $info) {
-        $file[$component . '.' . $identifier] = $info['hash'];
+        $file[substr($info['file'], 0, strrpos($info['file'], '.'))] = $info['hash'];
       }
     }
+    ksort($file);
     $file_content = "<?php\n\n";
     $file_content .= "// This file contains the current being tracked configurations.\n\n";
     $file_content .= '$tracked = ' . var_export($file, TRUE) . ";\n";
@@ -530,7 +561,17 @@ class ConfigurationManagement {
     foreach (array_unique($modules) as $module) {
       $file_content .= "  '$module',\n";
     }
-    $file_content .= ");\n";
+    $file_content .= ");\n\n";
+
+    if ($sets = cache_get('configuration_sets')) {
+      $file_content .= '$sets = ' . var_export($sets->data, TRUE) . ";\n";
+    }
+    else {
+      $tracking_file = static::readTrackingFile();
+      $file_content .= '$sets = ' . var_export($tracking_file['sets'], TRUE) . ";\n";
+    }
+
+
     if (Storage::checkFilePermissions('tracked.inc')) {
       file_put_contents(static::getStream() . 'tracked.inc', $file_content);
     }
@@ -543,10 +584,26 @@ class ConfigurationManagement {
     if (file_exists(static::getStream() . 'tracked.inc')) {
       $file_content = drupal_substr(file_get_contents(static::getStream() . 'tracked.inc'), 6);
       @eval($file_content);
-      return array(
-        'tracked' => $tracked,
-        'modules' => $modules,
+
+      $return = array(
+        'tracked' => array(),
+        'modules' => array(),
+        'sets' => array(),
       );
+
+      if (isset($tracked)) {
+        $return['tracked'] = $tracked;
+      }
+
+      if (isset($modules)) {
+        $return['modules'] = $modules;
+      }
+
+      if (isset($sets)) {
+        $return['sets'] = $sets;
+      }
+
+      return $return;
     }
     return array();
   }
diff --git a/lib/Drupal/configuration/Storage/Storage.php b/lib/Drupal/configuration/Storage/Storage.php
index c72d7b3..671c5e9 100644
--- a/lib/Drupal/configuration/Storage/Storage.php
+++ b/lib/Drupal/configuration/Storage/Storage.php
@@ -44,8 +44,13 @@ class Storage {
    */
   static public function checkFilePermissions($filename) {
     $dir_path = ConfigurationManagement::getStream();
+    $pos = strpos($filename, '/');
     $full_path = $dir_path . $filename;
-    if (is_writable($dir_path) || drupal_chmod($dir_path)) {
+    if ($pos !== FALSE) {
+      $dir_path = $dir_path . '/' . substr($filename, 0, $pos);
+    }
+
+    if (is_writable($dir_path) || drupal_mkdir($dir_path, NULL, TRUE) || drupal_chmod($dir_path)) {
       if (file_exists($full_path)) {
         if (is_writable($full_path) || drupal_chmod($full_path)) {
           return TRUE;
diff --git a/ui/configuration_ui.admin.inc b/ui/configuration_ui.admin.inc
index b7b881f..e947b1c 100644
--- a/ui/configuration_ui.admin.inc
+++ b/ui/configuration_ui.admin.inc
@@ -13,6 +13,7 @@ function configuration_ui_tracking_form($form, &$form_state) {
 
   $form_state['table_header'] = array(
     'names' => t('Configuration'),
+    'sets' => t('Set'),
     'status' => t('Status'),
     'operations' => t('Operations'),
   );
@@ -82,6 +83,7 @@ function configuration_ui_notracking_form($form, &$form_state) {
 
   $form_state['table_header'] = array(
     'names' => t('Configuration'),
+    'sets' => t('Set'),
     'operations' => t('Operations'),
   );
   configuration_ui_configuration_list('no_tracking', $configurations, $form, $form_state);
@@ -113,12 +115,12 @@ function configuration_ui_export_form($form, &$form_state) {
   );
   return $form;
 }
+
 /**
  * Helper function for configuration lists.
  */
 function configuration_ui_configuration_list($ui, $configurations, &$form, &$form_state) {
   $component_exists = FALSE;
-  $handlers = configuration_configuration_handlers();
 
   $form['packages'] = array('#type' => 'vertical_tabs');
   $form['#attached']['css'] = array(
@@ -128,6 +130,26 @@ function configuration_ui_configuration_list($ui, $configurations, &$form, &$for
     drupal_get_path('module', 'configuration_ui') . '/js/configuration_ui.js'
   );
 
+  $tracking_file = ConfigurationManagement::readTrackingFile();
+
+  $config_sets = array();
+  foreach ($tracking_file['tracked'] as $config => $hash) {
+    $pos = strrpos($config, '/');
+    if ($pos !== FALSE) {
+      $config_id = substr($config, $pos + 1);
+      $set = substr($config, 0, $pos);
+      $config_sets[$config_id] = $set;
+    }
+    else {
+      $config_sets[$config] = '';
+    }
+  }
+
+  $sets_form = array(
+    '#type' => 'select',
+    '#options' => array_merge(array('' => t('- None -')), $tracking_file['sets']),
+  );
+
   $form_state['component_exists'] = FALSE;
   foreach ($configurations as $component => $list) {
     $handler = ConfigurationManagement::getConfigurationHandler($component);
@@ -159,6 +181,9 @@ function configuration_ui_configuration_list($ui, $configurations, &$form, &$for
       'name' => array(
         '#tree' => TRUE,
       ),
+      'sets' => array(
+        '#tree' => TRUE,
+      ),
       'status' => array(
         '#tree' => TRUE,
       ),
@@ -195,6 +220,13 @@ function configuration_ui_configuration_list($ui, $configurations, &$form, &$for
         );
       }
 
+      if (!empty($sets_form) && !empty($form_state['table_header']['sets'])) {
+        $form[$component]['configurations']['sets'][$id] = $sets_form;
+        if ($ui == 'tracking') {
+          $form[$component]['configurations']['sets'][$id]['#default_value'] = $config_sets[$id];
+        }
+      }
+
       $form[$component]['configurations']['operations'][$id] = array(
         '#markup' => configurations_ui_operations_helper($ui, $id),
       );
@@ -304,19 +336,22 @@ function configuration_ui_config_status($component) {
   $tracked = ConfigurationManagement::trackedConfigurations();
   $status = array();
   $needs_attention = 0;
+  $debug = array();
   foreach ($tracked as $component_id => $info) {
     if ($component_id == $component) {
       foreach ($info as $identifier => $item) {
         $id = $component . '.' . $identifier;
-        $config = ConfigurationManagement::createConfigurationInstance($id);
+        $file = substr($item['file'], 0, strrpos($item['file'], '.'));
+        $config = ConfigurationManagement::createConfigurationInstance($file);
         $hash = $config->loadFromActiveStore()->getHash();
         if ($config->isBroken()) {
           $status[$id] = t('Removed from Active Store');
         }
-        elseif (empty($tracked_in_file['tracked'][$id])) {
+        elseif (empty($item['file'])) {
           $status[$id] = t('Active Store Only');
         }
         elseif ($hash != $item['hash']) {
+          $debug[$id] = $file . ' ' . $hash . ' != ' . $item['hash'];
           $status[$id] = t('Overriden');
         }
         else {
@@ -655,19 +690,34 @@ function configuration_ui_settings_form($form, &$form_state) {
     '#description' => t('You can use configurations sets to organize your tracked configurations into folders.'),
   );
 
+  $tracking_file = ConfigurationManagement::readTrackingFile();
+  $default_sets = '';
+  if (!empty($tracking_file['sets'])) {
+    foreach ($tracking_file['sets'] as $path => $set_name) {
+      $default_sets .= $path . '|' . $set_name . "\n";
+    }
+  }
+
   $form['configuration_sets']['configuration_sets'] = array(
     '#type' => 'textarea',
     '#title' => t('List of sets'),
-    '#description' => t('One set per line, no spaces allowed. Only alpha-numeric and underscores allowed.'),
+    '#description' => t('Enter one value per line, in the format path|label. Examples</br>content_types|Content types</br>custom_configurations|Custom configurations'),
     '#size' => 6,
-    '#default_value' => variable_get('configuration_sets', ''),
+    '#default_value' => $default_sets,
   );
 
-  $form['#validate'][] = 'configuration_ui_validate_settings';
-  return system_settings_form($form);
+  $form['actions']['#type'] = 'actions';
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save configuration')
+  );
+
+  $form['#validate'][] = 'configuration_ui_settings_validate';
+  $form['#submit'][] = 'configuration_ui_settings_submit';
+  return $form;
 }
 
-function configuration_ui_validate_settings($form, &$form_state) {
+function configuration_ui_settings_validate($form, &$form_state) {
   $form_element = $form['general_settings']['configuration_config_path'];
 
   if (empty($form_state['values']['configuration_remote_server'])) {
@@ -681,6 +731,45 @@ function configuration_ui_validate_settings($form, &$form_state) {
       watchdog('file system', 'The directory %directory does not exist.', array('%directory' => $directory), WATCHDOG_ERROR);
     }
   }
+
+  $list = explode("\n", $form_state['values']['configuration_sets']);
+  $list = array_map('trim', $list);
+  $list = array_filter($list, 'strlen');
+  $explicit_keys = TRUE;
+  foreach ($list as $position => $text) {
+    $value = $key = FALSE;
+
+    // Check for an explicit key.
+    $matches = array();
+    if (!preg_match('/(.+)\|(.+)/', $text, $matches)) {
+      $explicit_keys = FALSE;
+    }
+  }
+  if (!$explicit_keys) {
+    form_set_error('configuration_sets', t('The defined values are not valid. Please use path|label format, one item per line.'));
+  }
+}
+
+function configuration_ui_settings_submit($form, &$form_state) {
+  variable_set('configuration_remote_server', $form_state['values']['configuration_remote_server']);
+  variable_set('configuration_config_path', $form_state['values']['configuration_config_path']);
+
+  $sets = array();
+  $list = explode("\n", $form_state['values']['configuration_sets']);
+  $list = array_map('trim', $list);
+  $list = array_filter($list, 'strlen');
+  if (!empty($list)) {
+    foreach ($list as $position => $set) {
+      list($path, $set_name) = explode("|", $set, 2);
+      $sets[$path] = $set_name;
+    }
+  }
+  cache_set('configuration_sets', $sets);
+  $tracking_file = ConfigurationManagement::readTrackingFile();
+  ConfigurationManagement::updateTrackingFile($tracking_file['modules']);
+  cache_clear_all('configuration_sets', 'cache');
+
+  drupal_set_message(t('The configuration options have been saved.'));
 }
 
 /**
@@ -689,7 +778,12 @@ function configuration_ui_validate_settings($form, &$form_state) {
 function configuration_ui_get_form_components($form, &$form_state) {
   $component_list = array();
   foreach (array_filter($form_state['values']['items']) as $component) {
-    $component_list[] = $component;
+    if (!empty($form_state['values']['sets'][$component])) {
+      $component_list[] = $form_state['values']['sets'][$component] . '/' . $component;
+    }
+    else {
+      $component_list[] = $component;
+    }
   }
   return $component_list;
 }
@@ -738,6 +832,6 @@ function configuration_sync_configurations_submit($form, &$form_state) {
     drupal_set_message(t('Imported %config', array('%config' => $imported)));
   }
   foreach ($results->getInfo('no_handler') as $failed) {
-    drupal_set_message(t('%config could be imported because there is no module that can handle that configuration.', array('%config' => $failed)));
+    drupal_set_message(t('%config could not be imported because there is no module that can handle that configuration.', array('%config' => $failed)), 'error');
   }
 }
diff --git a/ui/js/configuration_ui.js b/ui/js/configuration_ui.js
index 975d7b6..458382b 100644
--- a/ui/js/configuration_ui.js
+++ b/ui/js/configuration_ui.js
@@ -37,6 +37,8 @@
 
       $("fieldset.configuration .form-checkbox").bind('click', function() {
         var current_checkbox = $(this);
+        var current_set = $('#' + this.id.replace('-items-', '-sets-'));
+
         var include_dependencies = $("input[name='include_dependencies']:checked").length;
         var include_optionals = $("input[name='include_optionals']:checked").length;
         if (include_optionals || include_dependencies) {
@@ -49,11 +51,16 @@
           }
           var original_value = current_checkbox.parents('td').next().html();
           current_checkbox.parents('td').next().html(original_value + ' ' + Drupal.t('(Finding dependencies...)'));
+          $("fieldset.configuration .form-checkbox").attr('disabled', 'disabled');
+          $("fieldset.configuration .form-select").attr('disabled', 'disabled');
           $.getJSON(Drupal.settings.basePath + 'admin/config/system/configuration/view/' + $(this).val() + '/' + url, function(data) {
 
             $.each(data, function(index, array) {
               if (current_checkbox.is(':checked')) {
                 $("input[value='" + array + "']").attr("checked", "checked");
+                if (!$("select[name='sets[" + array + "]']").val() || current_set.val() == '') {
+                  $("select[name='sets[" + array + "]']").val(current_set.val());
+                }
               }
               else{
                 $("input[value='" + array + "']").attr("checked", "");
@@ -61,6 +68,8 @@
 
             });
             current_checkbox.parents('td').next().html(original_value);
+            $("fieldset.configuration .form-checkbox").attr('disabled', '');
+            $("fieldset.configuration .form-select").attr('disabled', '');
             updateCheckedCount(context);
           });
         }
