diff --git a/easy_install.module b/easy_install.module
index df1bcbf..27e39fe 100755
--- a/easy_install.module
+++ b/easy_install.module
@@ -20,8 +20,9 @@ function easy_install_form_alter(&$form, FormStateInterface $form_state, $form_i
       ->get(\Drupal::currentUser()->id());
     foreach ($modules as $module) {
       $install_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
-      $details = file_scan_directory($install_dir, "/\.(yml)$/");
-      if (!empty($details)) {
+      $optional_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
+      $install_details = file_scan_directory($install_dir, "/\.(yml)$/");
+      if (!empty($install_details)) {
         $form['modules_config'][$module] = [
           '#type' => 'details',
           '#title' => t('@name', ['@name' => $module]),
@@ -30,35 +31,67 @@ function easy_install_form_alter(&$form, FormStateInterface $form_state, $form_i
           '#validated' => TRUE,
           '#open' => TRUE,
         ];
-        $details = file_scan_directory($install_dir, "/\.(yml)$/");
-        $options = [];
-        foreach ($details as $config_value) {
-          $options[$config_value->name] = $config_value->name;
+        $install_details = file_scan_directory($install_dir, "/\.(yml)$/");
+        $ins_options = [];
+        foreach ($install_details as $config_value) {
+          $ins_options[$config_value->name] = $config_value->name;
         }
-        if(!empty($options)) {
+        if(!empty($ins_options)) {
           $form['modules_config'][$module]['configs'] = [
             '#type' => 'checkboxes',
             '#label' => $config_value->name,
             '#title' => t('Select the configurations to be deleted'),
-            '#options' => $options,
+            '#options' => $ins_options,
+            '#validated' => TRUE,
+          ];
+        }
+        $optional_details = file_scan_directory($optional_dir, "/\.(yml)$/");
+        $opt_options = [];
+        foreach ($optional_details as $config_value) {
+          $opt_options[$config_value->name] = $config_value->name;
+        }
+        if(!empty($opt_options)) {
+          $form['modules_config'][$module]['opt_details'] = [
+            '#type' => 'details',
+            '#title' => "Optional Configurations",
+            '#weight' => 0,
+            '#validated' => TRUE,
+            '#open' => TRUE,
+          ];
+          $form['modules_config'][$module]['opt_details']['opt_configs'] = [
+            '#type' => 'checkboxes',
+            '#label' => $config_value->name,
+            '#options' => $opt_options,
             '#validated' => TRUE,
           ];
         }
       }
     }
-    if(!empty($options)) {
+    $label = 'Delete all the listed configurations except optional';
+    if(empty($opt_options)) {
+        $label = 'Delete all the listed configurations';
+    }
+    if(!empty($ins_options)) {
       foreach (array_keys($form['actions']) as $action) {
         if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
           $form['actions'][$action]['#submit'][0] = 'easy_install_form_submit';
         }
       }
-      $form['all_configs'] = [
+      $form['ins_all_configs'] = [
         '#type' => 'checkbox',
-        '#label' => t('Delete all the listed configurations'),
-        '#title' => t('Delete all the listed configurations'),
+        '#label' => $label,
+        '#title' => $label,
         '#validated' => TRUE,
       ];
     }
+    if(!empty($opt_options)) {
+        $form['opt_all_configs'] = [
+          '#type' => 'checkbox',
+          '#label' => 'Delete all the listed Optional configurations',
+          '#title' => 'Delete all the listed Optional configurations',
+          '#validated' => TRUE,
+        ];
+    }
   }
 
 }
@@ -75,16 +108,33 @@ function easy_install_form_submit(array $form, FormStateInterface $form_state) {
   $module_handler->uninstall($modules);
   $modules_list->delete($account);
   $msg = 'The selected modules have been uninstalled';
-  $configs = $form_state->getValue('configs') ? $form_state->getValue('configs') : [];
-  if ($form_state->getValue('all_configs') != 0) {
-    foreach ($configs as $key => $value) {
+  $ins_configs = $form_state->getValue('configs') ? $form_state->getValue('configs') : [];
+  if ($form_state->getValue('ins_all_configs') != 0) {
+    foreach ($ins_configs as $key => $value) {
       Drupal::configFactory()->getEditable($key)->delete();
     }
     $msg = 'The selected modules have been uninstalled and configurations
   deleted';
   }
   else {
-    foreach ($configs as $key => $values) {
+    foreach ($ins_configs as $key => $values) {
+      if ($values !== 0) {
+        Drupal::configFactory()->getEditable($key)->delete();
+        $msg = 'The selected modules have been uninstalled and configurations
+         deleted';
+      }
+    }
+  }
+  $opt_configs = $form_state->getValue('opt_configs') ? $form_state->getValue('opt_configs') : [];
+  if ($form_state->getValue('opt_all_configs') != 0) {
+    foreach ($opt_configs as $key => $value) {
+      Drupal::configFactory()->getEditable($key)->delete();
+    }
+    $msg = 'The selected modules have been uninstalled and configurations
+  deleted';
+  }
+  else {
+    foreach ($opt_configs as $key => $values) {
       if ($values !== 0) {
         Drupal::configFactory()->getEditable($key)->delete();
         $msg = 'The selected modules have been uninstalled and configurations
@@ -92,7 +142,6 @@ function easy_install_form_submit(array $form, FormStateInterface $form_state) {
       }
     }
   }
-
   drupal_set_message(t('@msg', ['@msg' => $msg]));
   $redirect = new Url('system.modules_uninstall');
   $form_state->setRedirectUrl($redirect);
diff --git a/src/Form/PurgeConfigurationsConfirmForm.php b/src/Form/PurgeConfigurationsConfirmForm.php
index a4be65a..860dc41 100644
--- a/src/Form/PurgeConfigurationsConfirmForm.php
+++ b/src/Form/PurgeConfigurationsConfirmForm.php
@@ -139,9 +139,10 @@ class PurgeConfigurationsConfirmForm extends ConfirmFormBase {
       '#items' => $this->modules['install'],
     ];
     foreach ($this->modules['install'] as $module => $module_name) {
-      $install_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
-      $details = file_scan_directory($install_dir, "/\.(yml)$/");
-      if (!empty($details)) {
+     $install_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
+      $optional_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
+      $install_details = file_scan_directory($install_dir, "/\.(yml)$/");
+      if (!empty($install_details)) {
         $form['modules_config'][$module] = [
           '#type' => 'details',
           '#title' => t('@name', ['@name' => $module]),
@@ -150,30 +151,62 @@ class PurgeConfigurationsConfirmForm extends ConfirmFormBase {
           '#validated' => TRUE,
           '#open' => TRUE,
         ];
-        $details = file_scan_directory($install_dir, "/\.(yml)$/");
-        $options = [];
-        foreach ($details as $config_value) {
-          $options[$config_value->name] = $config_value->name;
+        $install_details = file_scan_directory($install_dir, "/\.(yml)$/");
+        $ins_options = [];
+        foreach ($install_details as $config_value) {
+          $ins_options[$config_value->name] = $config_value->name;
         }
-        if(!empty($options)) {
+        if(!empty($ins_options)) {
           $form['modules_config'][$module]['configs'] = [
             '#type' => 'checkboxes',
             '#label' => $config_value->name,
-            '#title' => t('Select the configurations to be deleted'),
-            '#options' => $options,
+            '#title' => 'Select the configurations to be deleted',
+            '#options' => $ins_options,
+            '#validated' => TRUE,
+          ];
+        }
+        $optional_details = file_scan_directory($optional_dir, "/\.(yml)$/");
+        $opt_options = [];
+        foreach ($optional_details as $config_value) {
+          $opt_options[$config_value->name] = $config_value->name;
+        }
+        if(!empty($opt_options)) {
+          $form['modules_config'][$module]['opt_details'] = [
+            '#type' => 'details',
+            '#title' => "Optional Configurations",
+            '#weight' => 0,
+            '#validated' => TRUE,
+            '#open' => TRUE,
+          ];
+          $form['modules_config'][$module]['opt_details']['opt_configs'] = [
+            '#type' => 'checkboxes',
+            '#label' => $config_value->name,
+            '#options' => $opt_options,
             '#validated' => TRUE,
           ];
         }
       }
     }
-    if(!empty($options)) {
-      $form['all_configs'] = [
+    $label = 'Delete all the listed configurations except optional';
+    if(empty($opt_options)) {
+        $label = 'Delete all the listed configurations';
+    }
+     if(!empty($ins_options)) {
+      $form['ins_all_configs'] = [
         '#type' => 'checkbox',
-        '#label' => t('Delete all the listed configurations'),
-        '#title' => t('Delete all the listed configurations'),
+        '#label' => $label,
+        '#title' => $label,
         '#validated' => TRUE,
       ];
     }
+    if(!empty($opt_options)) {
+        $form['opt_all_configs'] = [
+          '#type' => 'checkbox',
+          '#label' => 'Delete all the listed Optional configurations',
+          '#title' => 'Delete all the listed Optional configurations',
+          '#validated' => TRUE,
+        ];
+    }
 
     return parent::buildForm($form, $form_state);
   }
@@ -184,16 +217,33 @@ class PurgeConfigurationsConfirmForm extends ConfirmFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     // Clear the key value store entry.
     $account = $this->currentUser()->id();
-    $configs = $form_state->getValue('configs') ? $form_state->getValue('configs') : [];
-    if ($form_state->getValue('all_configs') != 0) {
-      foreach ($configs as $key => $value) {
+    $ins_configs = $form_state->getValue('configs') ? $form_state->getValue('configs') : [];
+    if ($form_state->getValue('ins_all_configs') != 0) {
+      foreach ($ins_configs as $key => $value) {
+        \Drupal::configFactory()->getEditable($key)->delete();
+      }
+    }
+    else {
+      foreach ($ins_configs as $key => $values) {
+        if ($values !== 0) {
+          \Drupal::configFactory()->getEditable($key)->delete();
+        }
+      }
+    }
+    $opt_configs = $form_state->getValue('opt_configs') ? $form_state->getValue('opt_configs') : [];
+    if ($form_state->getValue('opt_all_configs') != 0) {  
+      foreach ($opt_configs as $key => $value) {
         \Drupal::configFactory()->getEditable($key)->delete();
       }
+      $msg = 'The selected modules have been uninstalled and configurations
+    deleted';
     }
     else {
-      foreach ($configs as $key => $values) {
+      foreach ($opt_configs as $key => $values) {
         if ($values !== 0) {
           \Drupal::configFactory()->getEditable($key)->delete();
+          $msg = 'The selected modules have been uninstalled and configurations
+          deleted';
         }
       }
     }
