diff --git a/modules/cloudinary_sdk/cloudinary_sdk.install b/modules/cloudinary_sdk/cloudinary_sdk.install
index baf47a4..4b9c289 100644
--- a/modules/cloudinary_sdk/cloudinary_sdk.install
+++ b/modules/cloudinary_sdk/cloudinary_sdk.install
@@ -5,14 +5,16 @@
  * Provides installation functions for cloudinary_sdk module.
  */
 
+use Cloudinary\Api;
 use Drupal\Core\Url;
 use Drupal\cloudinary_sdk\CloudinarySdkConstantsInterface;
+use Drupal\cloudinary_sdk\Form\CloudinarySdkSettingsForm as SettingsForm;
 
 /**
  * Implements hook_uninstall().
  */
 function cloudinary_sdk_uninstall() {
-  \Drupal::configFactory()->getEditable('cloudinary_sdk.settings')->delete();
+  \Drupal::configFactory()->getEditable(SettingsForm::SETTINGS)->delete();
 }
 
 /**
@@ -27,45 +29,73 @@ function cloudinary_sdk_requirements($phase) {
   }
 
   list($status, $version, $error_message) = cloudinary_sdk_check(TRUE);
-  $r = [
+  $report = [
     'severity' => REQUIREMENT_OK,
     'title' => t('Cloudinary'),
     'value' => $version,
   ];
 
   if ($status == CloudinarySdkConstantsInterface::CLOUDINARY_SDK_NOT_LOADED) {
-    $r['severity'] = REQUIREMENT_ERROR;
-    $r['value'] = t('Failed to load the Cloudinary SDK.');
+    $report['severity'] = REQUIREMENT_ERROR;
+    $report['value'] = t('Failed to load the Cloudinary SDK.');
     if ($error_message) {
-      $r['value'] .= ' ' . $error_message;
+      $report['value'] .= ' ' . $error_message;
     }
-    $r['description'] = t('Please make sure the Cloudinary SDK library is installed in the libraries directory.');
+    $report['description'] = t('Please make sure the Cloudinary SDK library is installed in the libraries directory.');
   }
   elseif ($status == CloudinarySdkConstantsInterface::CLOUDINARY_SDK_OLD_VERSION) {
-    $r['severity'] = REQUIREMENT_ERROR;
-    $r['description'] = t(
-      'Please make sure the Cloudinary SDK library installed is @version or greater. Current version is @current_version.',
-      [
-        '@version' => CloudinarySdkConstantsInterface::CLOUDINARY_SDK_MINIMUM_VERSION,
-        '@current_version' => $version,
-      ]
-    );
+    $report['severity'] = REQUIREMENT_ERROR;
+    $report['description'] = t('Please make sure the Cloudinary SDK library installed is @version or greater. Current version is @current_version.', [
+      '@version' => CloudinarySdkConstantsInterface::CLOUDINARY_SDK_MINIMUM_VERSION,
+      '@current_version' => $version,
+    ]);
   }
   else {
     // Ensure that the 3 required fields have been set.
     // Cloud name, API key, API secret.
     $config = cloudinary_sdk_config_load();
     if (empty($config)) {
-      $r['severity'] = REQUIREMENT_WARNING;
+      $report['severity'] = REQUIREMENT_WARNING;
       // Add link to configuration form.
       $url = Url::fromRoute('cloudinary_sdk.settings')->toString(TRUE)->getGeneratedUrl();
-      $r['description'] = t("The required cloud name, API key and API secret of Cloudinary hasn't been set. <a href=':url'>Configure</a>", [
+      $report['description'] = t("The required cloud name, API key and API secret of Cloudinary hasn't been set. <a href=':url'>Configure</a>", [
         ':url' => $url,
       ]);
     }
   }
 
-  $requirements['cloudinary_sdk'] = $r;
+  // Add some more information about the currentt usage.
+  if ($report['severity'] === REQUIREMENT_OK) {
+    $api = new Api();
+    $usage = (array) $api->usage();
+
+    $usage_report = [];
+    $usage_report[] = t('Cloudinary Plan: %plan, Credits: %used_percent (@usage / @limit)', [
+      '%plan' => $usage['plan'],
+      '%used_percent' => $usage['credits']['used_percent'] . '%',
+      '@usage' => $usage['credits']['usage'],
+      '@limit' => $usage['credits']['limit'],
+    ]);
+    $usage_report[] = '';
+    $usage_report[] = t('Storage: %credits_usage (@usage)', [
+      '%credits_usage' => $usage['storage']['credits_usage'] . '%',
+      '@usage' => $usage['storage']['usage'],
+    ]);
+    $usage_report[] = t('Bandwidth: %credits_usage (@usage)', [
+      '%credits_usage' => $usage['bandwidth']['credits_usage'] . '%',
+      '@usage' => $usage['bandwidth']['usage'],
+    ]);
+    $usage_report[] = t('Transformations: %credits_usage (@usage)', [
+      '%credits_usage' => $usage['transformations']['credits_usage'] . '%',
+      '@usage' => $usage['transformations']['usage'],
+    ]);
+    $usage_report[] = t('Objects: %usage', [
+      '%usage' => $usage['objects']['usage'],
+    ]);
+
+    $report['description'] = [
+      '#markup' => implode('<br />', $usage_report),
+    ];
 
   return $requirements;
 }
diff --git a/modules/cloudinary_sdk/cloudinary_sdk.module b/modules/cloudinary_sdk/cloudinary_sdk.module
index b3b8046..7f9873d 100644
--- a/modules/cloudinary_sdk/cloudinary_sdk.module
+++ b/modules/cloudinary_sdk/cloudinary_sdk.module
@@ -88,7 +88,6 @@ function cloudinary_sdk_help($route_name) {
   ];
   $api_image = $renderer->render($api);
 
-
   $output = '';
   $url = Url::fromUri('http://www.cloudinary.com/');
   $url_console = Url::fromUri('http://www.cloudinary.com/console');
diff --git a/modules/cloudinary_sdk/config/schema/cloudinary_sdk.schema.yml b/modules/cloudinary_sdk/config/schema/cloudinary_sdk.schema.yml
index a2a20b1..473617c 100644
--- a/modules/cloudinary_sdk/config/schema/cloudinary_sdk.schema.yml
+++ b/modules/cloudinary_sdk/config/schema/cloudinary_sdk.schema.yml
@@ -13,12 +13,13 @@ cloudinary_sdk.settings:
       type: string
     cloudinary_stream_wrapper_logging:
       label: 'Stream Wrapper Logging'
-      type: integer
-    cloudinary_storage_default:
-      label: 'Default Storage'
-      type: string
+      type: boolean
     cloudinary_stream_wrapper_folders:
       label: 'Stream Wrapper Folders'
       type: sequence
       sequence:
-        type: integer
+        type: string
+        label: 'Folder'
+    cloudinary_storage_default:
+      label: 'Default Storage'
+      type: string
diff --git a/modules/cloudinary_sdk/src/Form/CloudinarySdkSettingsForm.php b/modules/cloudinary_sdk/src/Form/CloudinarySdkSettingsForm.php
index 49c9f30..d41f0d7 100644
--- a/modules/cloudinary_sdk/src/Form/CloudinarySdkSettingsForm.php
+++ b/modules/cloudinary_sdk/src/Form/CloudinarySdkSettingsForm.php
@@ -14,6 +14,11 @@ use Drupal\cloudinary_sdk\CloudinarySdkConstantsInterface;
  */
 class CloudinarySdkSettingsForm extends ConfigFormBase {
 
+  /**
+   * The editable config name.
+   */
+  const SETTINGS = 'cloudinary_sdk.settings';
+
   /**
    * {@inheritdoc}
    */
@@ -25,7 +30,7 @@ class CloudinarySdkSettingsForm extends ConfigFormBase {
    * {@inheritdoc}
    */
   protected function getEditableConfigNames() {
-    return ['cloudinary_sdk.settings'];
+    return [static::SETTINGS];
   }
 
   /**
@@ -39,17 +44,17 @@ class CloudinarySdkSettingsForm extends ConfigFormBase {
     $disabled = FALSE;
 
     if ($status == CloudinarySdkConstantsInterface::CLOUDINARY_SDK_NOT_LOADED) {
-      drupal_set_message($this->t('Please make sure the Cloudinary SDK library is installed in the libraries directory.'), 'error');
+      $this->messenger()->addError($this->t('Please make sure the Cloudinary SDK library is installed in the libraries directory.'));
       if ($error_message) {
-        drupal_set_message($error_message, 'error');
+        $this->messenger()->addError($this->t('Please make sure the Cloudinary SDK library is installed in the libraries directory.'));
       }
       return;
     }
     elseif ($status == CloudinarySdkConstantsInterface::CLOUDINARY_SDK_OLD_VERSION) {
-      drupal_set_message($this->t('Please make sure the Cloudinary SDK library installed is @version or greater. Current version is @current_version.', [
+      $this->messenger()->addWarning($this->t('Please make sure the Cloudinary SDK library installed is @version or greater. Current version is @current_version.', [
         '@version' => CloudinarySdkConstantsInterface::CLOUDINARY_SDK_MINIMUM_VERSION,
         '@current_version' => $version,
-      ]), 'warning');
+      ]));
       return;
     }
 
@@ -58,36 +63,36 @@ class CloudinarySdkSettingsForm extends ConfigFormBase {
 
     $form['settings'] = [
       '#type' => 'fieldset',
-      '#title' => t('API Settings'),
+      '#title' => $this->t('API Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-      '#description' => t('You should enable "Auto-create folders" on cloudinary account. In order to check the validity of the API, system will be auto ping your Cloudinary account after change API settings.'),
+      '#description' => $this->t('You should enable "Auto-create folders" on cloudinary account. In order to check the validity of the API, system will be auto ping your Cloudinary account after change API settings.'),
     ];
 
     $form['settings']['cloudinary_sdk_cloud_name'] = [
       '#type' => 'textfield',
-      '#title' => t('Cloud name'),
+      '#title' => $this->t('Cloud name'),
       '#required' => TRUE,
       '#default_value' => $config->get('cloudinary_sdk_cloud_name'),
-      '#description' => t('Cloud name of Cloudinary.'),
+      '#description' => $this->t('Cloud name of Cloudinary.'),
       '#disabled' => $disabled,
     ];
 
     $form['settings']['cloudinary_sdk_api_key'] = [
       '#type' => 'textfield',
-      '#title' => t('API key'),
+      '#title' => $this->t('API key'),
       '#required' => TRUE,
       '#default_value' => $config->get('cloudinary_sdk_api_key'),
-      '#description' => t('API key of Cloudinary.'),
+      '#description' => $this->t('API key of Cloudinary.'),
       '#disabled' => $disabled,
     ];
 
     $form['settings']['cloudinary_sdk_api_secret'] = [
       '#type' => 'textfield',
-      '#title' => t('API secret'),
+      '#title' => $this->t('API secret'),
       '#required' => TRUE,
       '#default_value' => $config->get('cloudinary_sdk_api_secret'),
-      '#description' => t('API secret of Cloudinary.'),
+      '#description' => $this->t('API secret of Cloudinary.'),
       '#disabled' => $disabled,
     ];
 
@@ -98,7 +103,7 @@ class CloudinarySdkSettingsForm extends ConfigFormBase {
    * {@inheritdoc}
    */
   public function validateForm(array &$form, FormStateInterface $form_state) {
-    $config = $this->config('cloudinary_sdk.settings');
+    $config = $this->config(static::SETTINGS);
     $cloud_name = trim($form_state->getValue(['cloudinary_sdk_cloud_name']));
     $api_key = trim($form_state->getValue(['cloudinary_sdk_api_key']));
     $api_secret = trim($form_state->getValue(['cloudinary_sdk_api_secret']));
@@ -139,25 +144,14 @@ class CloudinarySdkSettingsForm extends ConfigFormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    $config = $this->config('cloudinary_sdk.settings');
+    $config = $this->configFactory()->getEditable(static::SETTINGS);
     $values = $form_state->getValues();
+
     foreach ($values as $field => $value) {
-      if (!in_array($field, [
-        'op',
-        'submit',
-        'form_id',
-        'form_token',
-        'form_build_id',
-      ])) {
-        $config->set(str_replace('.', '_', $field), $value);
-      }
+      $config->set($field, $value);
     }
     $config->save();
 
-    if (method_exists($this, '_submitForm')) {
-      $this->_submitForm($form, $form_state);
-    }
-
     parent::submitForm($form, $form_state);
   }
 
diff --git a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.api.php b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.api.php
index 5df8c7a..cc9b79f 100644
--- a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.api.php
+++ b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.api.php
@@ -19,7 +19,7 @@ function hook_cloudinary_stream_wrapper_resource_create(array $resource) {
     if ($storage_class = cloudinary_storage_class()) {
       $storage = new $storage_class($resource);
       list($path, $file) = $storage->resourceUpdate();
-      $data = array(CLOUDINARY_STORAGE_NEW => $file);
+      $data = [CLOUDINARY_STORAGE_NEW => $file];
 
       if ($resource['mode'] == CLOUDINARY_STREAM_WRAPPER_FILE) {
         $storage->folderUpdate($path, $data);
@@ -53,15 +53,15 @@ function hook_cloudinary_stream_wrapper_resource_rename(array $src_resource, arr
     list($dst_path, $dst_file) = $dst_storage->resourceUpdate();
 
     if ($src_path !== FALSE && $src_path == $dst_path) {
-      $src_storage->folderUpdate($src_path, array(CLOUDINARY_STORAGE_NEW => $dst_file, CLOUDINARY_STORAGE_REMOVE => $src_file));
+      $src_storage->folderUpdate($src_path, [CLOUDINARY_STORAGE_NEW => $dst_file, CLOUDINARY_STORAGE_REMOVE => $src_file]);
     }
     else {
       if ($src_path !== FALSE) {
-        $src_storage->folderUpdate($src_path, array(CLOUDINARY_STORAGE_REMOVE => $src_file));
+        $src_storage->folderUpdate($src_path, [CLOUDINARY_STORAGE_REMOVE => $src_file]);
       }
 
       if ($dst_path !== FALSE) {
-        $dst_storage->folderUpdate($dst_path, array(CLOUDINARY_STORAGE_NEW => $dst_file));
+        $dst_storage->folderUpdate($dst_path, [CLOUDINARY_STORAGE_NEW => $dst_file]);
       }
     }
   }
@@ -121,7 +121,7 @@ function hook_cloudinary_stream_wrapper_resource_delete(array $resource) {
       list($path, $file) = $storage->resourceUpdate(FALSE);
 
       if ($resource['mode'] == CLOUDINARY_STREAM_WRAPPER_FILE) {
-        $storage->folderUpdate($path, array(CLOUDINARY_STORAGE_REMOVE => $file));
+        $storage->folderUpdate($path, [CLOUDINARY_STORAGE_REMOVE => $file]);
       }
     }
   }
@@ -142,13 +142,13 @@ function hook_cloudinary_stream_wrapper_resource_delete(array $resource) {
 function hook_cloudinary_stream_wrapper_transformation() {
   $path = drupal_get_path('module', 'cloudinary');
 
-  return array(
-    'image_crop' => array(
+  return [
+    'image_crop' => [
       'title' => t('Crop'),
       'callback' => 'cloudinary_transformation_image_crop',
       'file' => $path . '/includes/cloudinary.transformation.drupal.inc',
-    ),
-  );
+    ],
+  ];
 }
 
 /**
diff --git a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.install b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.install
index 83b6a85..ec0ceeb 100644
--- a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.install
+++ b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.install
@@ -5,12 +5,14 @@
  * Provides installation functions.
  */
 
+use Drupal\cloudinary_sdk\Form\CloudinarySdkSettingsForm as SettingsForm;
+
 /**
  * Implements hook_uninstall().
  */
 function cloudinary_stream_wrapper_uninstall() {
   // Remove config.
-  $config = \Drupal::configFactory()->getEditable('cloudinary.settings');
+  $config = \Drupal::configFactory()->getEditable(SettingsForm::SETTINGS);
   $config->clear('cloudinary_stream_wrapper_folders');
   $config->clear('cloudinary_stream_wrapper_logging');
   $config->save();
@@ -21,7 +23,7 @@ function cloudinary_stream_wrapper_uninstall() {
  */
 function cloudinary_stream_wrapper_update_8001() {
   // Remove config.
-  $config = \Drupal::configFactory()->getEditable('cloudinary_sdk.settings');
+  $config = \Drupal::configFactory()->getEditable(SettingsForm::SETTINGS);
   $config->clear('cloudinary_stream_wrapper_enable_api_folder_creation');
   $config->save();
 }
diff --git a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.module b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.module
index 173d376..085a6da 100644
--- a/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.module
+++ b/modules/cloudinary_stream_wrapper/cloudinary_stream_wrapper.module
@@ -4,7 +4,11 @@
  * @file
  * File for the Cloudinary Stream Wrapper module.
  */
+
+use Cloudinary\Api;
+use Cloudinary\Uploader;
 use Drupal\image\Entity\ImageStyle;
+use Drupal\cloudinary_sdk\Form\CloudinarySdkSettingsForm as SettingsForm;
 
 /**
  * Flag for dealing with Cloudinary file.
@@ -54,13 +58,13 @@ define('CLOUDINARY_STREAM_WRAPPER_TRANSFORMATION_MULTIPLE', 2);
 /**
  * Implements hook_help().
  */
-function cloudinary_stream_wrapper_help($path, $arg) {
+function cloudinary_stream_wrapper_help($route_name) {
   $output = '';
 
-  switch ($path) {
-    case 'admin/help#cloudinary_stream_wrapper':
+  switch ($route_name) {
+    case 'help.page.cloudinary_stream_wrapper':
       $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t("The Cloudinary module allows the local file system to be replaced with Cloudinary. Uploads are saved into the Drupal file table using Drupal 7's file stream wrapper system.") . '</p>';
+      $output .= '<p>' . t("The Cloudinary module allows the local file system to be replaced with Cloudinary. Uploads are saved into the Drupal file table using Drupal 8's file stream wrapper system.") . '</p>';
       $output .= '<h3>' . t('How to use') . '</h3>';
       $output .= '<ul>';
       $output .= '<li>' . t("Image upload - Securely upload images or any other file, at any scale from any source. API for fast upload directly from your user's browsers or mobile apps.") . '</li>';
@@ -90,44 +94,42 @@ function cloudinary_stream_wrapper_form_cloudinary_sdk_settings_alter(&$form, $f
   }
 
   // Get Cloudinary SDK configs.
-  $configs = \Drupal::config('cloudinary_sdk.settings');
+  $configs = \Drupal::config(SettingsForm::SETTINGS);
 
-  $form['settings']['cloudinary_stream_wrapper_logging'] = array(
+  $form['settings']['cloudinary_stream_wrapper_logging'] = [
     '#type' => 'checkbox',
     '#title' => t('Enable error logging.'),
     '#default_value' => (bool) $configs->get('cloudinary_stream_wrapper_logging'),
     '#description' => t('Enable if you want to logging any errors messages during file processing by cloudinary.'),
-  );
+  ];
 
   $root_folders = cloudinary_stream_wrapper_load_resource('');
 
-  /**
-   * Issue #2992506 by otrolopezmas, lquessenberry: Cloudinary Stream Wrapper - Non existent default value for folder displays a warning
-   */
-
+  // Issue #2992506 by otrolopezmas, lquessenberry:
+  // Cloudinary Stream Wrapper - Non existent default value for
+  // folder displays a warning.
   if (!empty($root_folders['folders'])) {
-    $folders = array();
+    $folders = [];
     foreach ($root_folders['folders'] as $folder) {
       $folders[str_replace('.', '_', $folder)] = 'Folder: /' . $folder . ' [cloudinary.' . $folder . '://]';
     }
 
-    $form['folders'] = array(
+    $form['folders'] = [
       '#type' => 'fieldset',
       '#title' => t('Stream Wrapper Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
       '#description' => t('You can enable more stream wrappers for Cloudinary with root folders.'),
-    );
+    ];
 
     $config_value = $configs->get('cloudinary_stream_wrapper_folders');
-    $default_value = is_array($config_value) && !empty($config_value) ? $config_value : [];
 
-    $form['folders']['cloudinary_stream_wrapper_folders'] = array(
+    $form['folders']['cloudinary_stream_wrapper_folders'] = [
       '#type' => 'checkboxes',
       '#title' => t('Cloudinary scheme with root folder'),
       '#options' => $folders,
-      '#default_value' => $default_value,
-    );
+      '#default_value' => !empty($config_value) ? $config_value : [],
+    ];
   }
 }
 
@@ -135,7 +137,7 @@ function cloudinary_stream_wrapper_form_cloudinary_sdk_settings_alter(&$form, $f
  * Load file or folder resource from Cloudinary.
  */
 function cloudinary_stream_wrapper_resource($public_id, $options, $reset = FALSE) {
-  $resources = &drupal_static(__FUNCTION__, array());
+  $resources = &drupal_static(__FUNCTION__, []);
   // Unset resource of static variables if reset.
   if ($reset) {
     if (isset($resources[$public_id])) {
@@ -159,11 +161,11 @@ function cloudinary_stream_wrapper_resource($public_id, $options, $reset = FALSE
 /**
  * Load files in folder on Cloudinary.
  */
-function cloudinary_stream_wrapper_load_folder_files($tag, $options = array()) {
-  $resources = array();
+function cloudinary_stream_wrapper_load_folder_files($tag, $options = []) {
+  $resources = [];
 
   try {
-    $api = new \Cloudinary\Api();
+    $api = new Api();
     $data = (array) $api->resources_by_tag($tag, $options);
     if (!empty($data['resources'])) {
       $resources = $data['resources'];
@@ -205,7 +207,7 @@ function cloudinary_stream_wrapper_load_folder_files($tag, $options = array()) {
  * It provides some hooks to intergate with other storage.
  */
 function cloudinary_stream_wrapper_resource_prepare($public_id) {
-  $data = array('public_id' => $public_id);
+  $data = ['public_id' => $public_id];
   $resource = \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_prepare', [$data]);
 
   if ($data != $resource) {
@@ -218,7 +220,7 @@ function cloudinary_stream_wrapper_resource_prepare($public_id) {
 /**
  * Load file resource on Cloudinary.
  */
-function cloudinary_stream_wrapper_load_resource($public_id, $options = array()) {
+function cloudinary_stream_wrapper_load_resource($public_id, $options = []) {
   // Load file resource locally first.
   if ($resource = cloudinary_stream_wrapper_resource_prepare($public_id)) {
     return $resource;
@@ -235,9 +237,6 @@ function cloudinary_stream_wrapper_load_resource($public_id, $options = array())
     }
   }
   else {
-    //if (cloudinary_stream_wrapper_resource_prepare($public_id) == FALSE) {
-    // return FALSE;
-    //}
     // Return file resource on Cloudinary.
     if ($resource = cloudinary_stream_wrapper_load_file($public_id, $options)) {
       return $resource;
@@ -274,10 +273,10 @@ function cloudinary_stream_wrapper_delete_resource($resource) {
  */
 function cloudinary_stream_wrapper_resource_file_structure($resource) {
   if (!is_array($resource)) {
-    $resource = array();
+    $resource = [];
   }
 
-  $keys = array(
+  $keys = [
     'public_id' => '',
     'format' => '',
     'version' => '',
@@ -291,7 +290,7 @@ function cloudinary_stream_wrapper_resource_file_structure($resource) {
     'secure_url' => '',
     'tags' => '',
     'context' => '',
-  );
+  ];
 
   $resource = array_intersect_key($resource, $keys);
   $resource['mode'] = CLOUDINARY_STREAM_WRAPPER_FILE;
@@ -303,15 +302,15 @@ function cloudinary_stream_wrapper_resource_file_structure($resource) {
 /**
  * Build folder resource structure for Cloudinary.
  */
-function cloudinary_stream_wrapper_resource_folder_structure($path, $folders = array(), $files = array()) {
-  return array(
+function cloudinary_stream_wrapper_resource_folder_structure($path, $folders = [], $files = []) {
+  return [
     'public_id' => $path,
     'mode' => CLOUDINARY_STREAM_WRAPPER_FOLDER,
     'bytes' => 0,
     'timestamp' => 0,
     'folders' => $folders,
     'files' => $files,
-  );
+  ];
 }
 
 /**
@@ -322,9 +321,10 @@ function cloudinary_stream_wrapper_create_file($base64_data, $options) {
     $options['api_key'] = \Drupal::config('cloudinary_sdk.settings')->get('cloudinary_sdk_api_key');
     $options['api_secret'] = \Drupal::config('cloudinary_sdk.settings')->get('cloudinary_sdk_api_secret');
     $options['cloud_name'] = \Drupal::config('cloudinary_sdk.settings')->get('cloudinary_sdk_cloud_name');
+
     // Allow change of the options in the very last moment before upload.
     \Drupal::moduleHandler()->alter('cloudinary_stream_wrapper_options', $options);
-    $data = (array) \Cloudinary\Uploader::upload($base64_data, $options);
+    $data = (array) Uploader::upload($base64_data, $options);
     $resource = cloudinary_stream_wrapper_resource_file_structure($data);
     \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_create', [$resource]);
 
@@ -346,7 +346,7 @@ function cloudinary_stream_wrapper_create_file($base64_data, $options) {
  */
 function cloudinary_stream_wrapper_delete_file($resource) {
   try {
-    \Cloudinary\Uploader::destroy($resource['public_id']);
+    Uploader::destroy($resource['public_id']);
     \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_delete', [$resource]);
 
     return TRUE;
@@ -365,12 +365,12 @@ function cloudinary_stream_wrapper_delete_file($resource) {
 /**
  * Load file on Cloudinary.
  */
-function cloudinary_stream_wrapper_load_file($public_id, $options = array()) {
-  $resource = array();
+function cloudinary_stream_wrapper_load_file($public_id, $options = []) {
+  $resource = [];
 
   // Try to load file resource on Cloudinary.
   try {
-    $api = new \Cloudinary\Api();
+    $api = new Api();
     $data = (array) $api->resource($public_id, $options);
     $resource = cloudinary_stream_wrapper_resource_file_structure($data);
     \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_loaded', [$resource]);
@@ -394,14 +394,16 @@ function cloudinary_stream_wrapper_rename_file($src_resource, $dst_public_id) {
   $dst_folder = dirname($dst_public_id);
 
   try {
-    $data = \Cloudinary\Uploader::rename($src_resource['public_id'], $dst_public_id);
+    $data = Uploader::rename($src_resource['public_id'], $dst_public_id);
+
     // Replace new tag if folder name different.
     if ($src_folder != $dst_folder) {
       $tag = CLOUDINARY_STREAM_WRAPPER_FOLDER_TAG_PREFIX . $dst_folder;
-      \Cloudinary\Uploader::replace_tag($tag, array($data['public_id']));
+      Uploader::replace_tag($tag, [$data['public_id']]);
     }
+
     // Load new file resource.
-    $dst_resource = cloudinary_stream_wrapper_load_file($data['public_id'], array('resource_type' => $data['resource_type']));
+    $dst_resource = cloudinary_stream_wrapper_load_file($data['public_id'], ['resource_type' => $data['resource_type']]);
     \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_rename', [$src_resource, $dst_resource]);
 
     return TRUE;
@@ -410,7 +412,7 @@ function cloudinary_stream_wrapper_rename_file($src_resource, $dst_public_id) {
     $options = [
       '%file' => $src_resource['public_id'],
       '%newfile' => $dst_public_id,
-      '%message' => $e->getMessage()
+      '%message' => $e->getMessage(),
     ];
     cloudinary_stream_wrapper_logger('Rename file [%file] to new file [%newfile] failed, [%message].', $options);
   }
@@ -451,9 +453,9 @@ function cloudinary_stream_wrapper_delete_folder($resource) {
   }
 
   try {
-    $api = new \Cloudinary\Api();
-    $api->delete_resources_by_prefix($resource['public_id'], array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE));
-    $api->delete_resources_by_prefix($resource['public_id'], array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW));
+    $api = new Api();
+    $api->delete_resources_by_prefix($resource['public_id'], ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE]);
+    $api->delete_resources_by_prefix($resource['public_id'], ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW]);
     \Drupal::moduleHandler()->invokeAll('cloudinary_stream_wrapper_resource_delete', [$resource]);
 
     return TRUE;
@@ -476,15 +478,15 @@ function cloudinary_stream_wrapper_load_folder($path) {
   $data = cloudinary_stream_wrapper_get_folders($path);
 
   if ($data !== FALSE && is_array($data)) {
-    $folders = array();
+    $folders = [];
 
     foreach ($data as $folder) {
       $folders[] = $folder['name'];
     }
     // Load files in current path on Cloudinary.
     $tag = CLOUDINARY_STREAM_WRAPPER_FOLDER_TAG_PREFIX . $path;
-    $image_files = cloudinary_stream_wrapper_load_folder_files($tag, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE));
-    $raw_files = cloudinary_stream_wrapper_load_folder_files($tag, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW));
+    $image_files = cloudinary_stream_wrapper_load_folder_files($tag, ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE]);
+    $raw_files = cloudinary_stream_wrapper_load_folder_files($tag, ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW]);
     $files = array_merge($image_files, $raw_files);
 
     $resource = cloudinary_stream_wrapper_resource_folder_structure($path, $folders, $files);
@@ -508,11 +510,11 @@ function cloudinary_stream_wrapper_is_image($uri) {
  *
  * False if path not exist.
  */
-function cloudinary_stream_wrapper_get_folders($path = '', $options = array()) {
+function cloudinary_stream_wrapper_get_folders($path = '', $options = []) {
   $folders = FALSE;
 
   try {
-    $api = new \Cloudinary\Api();
+    $api = new Api();
     $data = (array) $api->subfolders($path, $options);
 
     if (isset($data['folders'])) {
@@ -534,7 +536,7 @@ function cloudinary_stream_wrapper_get_folders($path = '', $options = array()) {
  * Convert drupal image style to Cloudinary transformation.
  */
 function cloudinary_stream_wrapper_transformation($style_name, $resource) {
-  $transformations = &drupal_static(__FUNCTION__, array());
+  $transformations = &drupal_static(__FUNCTION__, []);
 
   if (!isset($transformations[$style_name])) {
     $effects = cloudinary_stream_wrapper_transformation_info();
@@ -552,8 +554,8 @@ function cloudinary_stream_wrapper_transformation($style_name, $resource) {
       return FALSE;
     }
 
-    $transformation = array();
-    $tmp_effect = array();
+    $transformation = [];
+    $tmp_effect = [];
 
     foreach ($style_effects_config as $effect) {
       if (!isset($effects[$effect['id']])) {
@@ -567,7 +569,7 @@ function cloudinary_stream_wrapper_transformation($style_name, $resource) {
         continue;
       }
 
-      $datas = ($return['type'] == CLOUDINARY_STREAM_WRAPPER_TRANSFORMATION_MULTIPLE) ? $return['data'] : array($return);
+      $datas = ($return['type'] == CLOUDINARY_STREAM_WRAPPER_TRANSFORMATION_MULTIPLE) ? $return['data'] : [$return];
       foreach ($datas as $data) {
         if ($data['type'] == CLOUDINARY_STREAM_WRAPPER_TRANSFORMATION_APPEND) {
           $tmp_effect = array_merge($tmp_effect, $data['data']);
@@ -626,9 +628,9 @@ function cloudinary_stream_wrapper_remote_image_info($url, $filesize = FALSE) {
     return FALSE;
   }
 
-  $result = array();
+  $result = [];
   $data_block = '';
-  $headers = array();
+  $headers = [];
 
   try {
     $handle = fopen($url, 'rb');
@@ -680,13 +682,13 @@ function cloudinary_stream_wrapper_remote_image_info($url, $filesize = FALSE) {
 /**
  * Logging error messages.
  *
- * @param $message string
+ * @param string $message
  *   Error message.
  * @param array $options
  *   Message options.
  */
-function cloudinary_stream_wrapper_logger($message, $options = []) {
-  $enable = \Drupal::config('cloudinary_sdk.settings')->get('cloudinary_stream_wrapper_logging');
+function cloudinary_stream_wrapper_logger(string $message, array $options = []) {
+  $enable = \Drupal::config(SettingsForm::SETTINGS)->get('cloudinary_stream_wrapper_logging');
   if (!empty($enable)) {
     \Drupal::logger('cloudinary_stream_wrapper')->error($message, $options);
   }
diff --git a/modules/cloudinary_stream_wrapper/src/CloudinaryStreamWrapperServiceProvider.php b/modules/cloudinary_stream_wrapper/src/CloudinaryStreamWrapperServiceProvider.php
index bce182c..333e8ee 100644
--- a/modules/cloudinary_stream_wrapper/src/CloudinaryStreamWrapperServiceProvider.php
+++ b/modules/cloudinary_stream_wrapper/src/CloudinaryStreamWrapperServiceProvider.php
@@ -1,32 +1,38 @@
 <?php
-/**
- * Created by DOOR3 Business Applications, Inc.
- * Developer: Sean Robertson
- * Date: 8/2/16
- * Time: 2:46 PM
- */
+
 namespace Drupal\cloudinary_stream_wrapper;
 
+use Drupal\cloudinary_sdk\Form\CloudinarySdkSettingsForm as SettingsForm;
+use Drupal\cloudinary_stream_wrapper\StreamWrapper\CloudinaryStreamWrapper;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
 
+/**
+ * Provides stream wrappers Cloudinary folders.
+ */
 class CloudinaryStreamWrapperServiceProvider implements ServiceProviderInterface  {
 
+  /**
+   * {@inheritdoc}
+   */
   public function register(ContainerBuilder $container) {
-    if (\Drupal::hasContainer()) {
-      $folders = \Drupal::config('cloudinary_sdk.settings')->get('cloudinary_stream_wrapper_folders');
+    if (
+      $container->has('config.factory') &&
+      $container->hasParameter('cache_default_bin_backends')
+    ) {
+      $config = $container->get('config.factory')->get(SettingsForm::SETTINGS);
+      $folders = $config->get('cloudinary_stream_wrapper_folders');
       if (is_array($folders)) {
         $folders = array_filter($folders);
       }
       if (!empty($folders)) {
         foreach ($folders as $folder) {
-          //$wrappers['cloudinary.' . $folder] = $base;
-          //$wrappers['cloudinary.' . $folder]['name'] .= ' (/' . $folder . ')';
-
-          $container->register('stream_wrapper.cloudinary.' . $folder, 'Drupal\cloudinary_stream_wrapper\StreamWrapper\CloudinaryStreamWrapper')
+          $container
+            ->register('stream_wrapper.cloudinary.' . $folder, CloudinaryStreamWrapper::class)
             ->addTag('stream_wrapper', ['scheme' => $folder]);
         }
       }
     }
   }
+
 }
diff --git a/modules/cloudinary_stream_wrapper/src/StreamWrapper/CloudinaryStreamWrapper.php b/modules/cloudinary_stream_wrapper/src/StreamWrapper/CloudinaryStreamWrapper.php
index c2461ed..f417a1c 100644
--- a/modules/cloudinary_stream_wrapper/src/StreamWrapper/CloudinaryStreamWrapper.php
+++ b/modules/cloudinary_stream_wrapper/src/StreamWrapper/CloudinaryStreamWrapper.php
@@ -1,69 +1,70 @@
 <?php
+
 namespace Drupal\cloudinary_stream_wrapper\StreamWrapper;
 
 // These classes are used to implement a stream wrapper class.
 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
-use Drupal\Component\Utility\Html;
-use Drupal\Core\Routing\UrlGeneratorTrait;
-use Drupal\image\Entity\ImageStyle;
 
 /**
  * Implement DrupalStreamWrapperInterface with cloudinary[.folder]://.
  */
 class CloudinaryStreamWrapper implements StreamWrapperInterface {
+
   /**
    * Instance URI (stream).
    *
    * A stream is referenced as "scheme://target".
    *
-   * @var String
+   * @var string|null
    */
   protected $uri;
 
   /**
    * Folder name as a prefix name of public_id.
    *
-   * @var String
+   * @var string|null
    */
   protected $folderName = NULL;
 
   /**
    * The resource type of Cloudinary (image, raw).
    *
-   * @var String
+   * @var string
    */
   protected $resourceType = CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW;
 
   /**
    * The pointer to the next read or write.
    *
-   * @var Int
+   * @var int
    */
   protected $streamPointer = 0;
 
   /**
    * A buffer for reading/wrting.
    *
-   * @var String
+   * @var string|null
    */
   protected $streamData = NULL;
 
   /**
    * This $stream_write property is flagged for data written.
    *
-   * @var Boolean
+   * @var bool
    */
   protected $streamWrite = FALSE;
 
   /**
    * List of files in a given directory.
+   *
+   * @var array
    */
-  protected $directoryList = array();
+  protected $directoryList = [];
 
   /**
    * A current file resource of Cloudinary.
    *
-   * @var Array
+   * @var array|null
    */
   protected $resource = NULL;
 
@@ -122,11 +123,14 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
 
   /**
    * Check uri is an image style.
+   *
+   * @return string[]|bool
+   *   The image style paths or FALSE.
    */
   protected function imageStylePaths($uri) {
     $paths = explode('/', $this->getTarget($uri));
-    $target = array_shift($paths);
-    if ($target == 'styles') {
+
+    if (array_shift($paths) == 'styles') {
       return $paths;
     }
 
@@ -138,6 +142,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
    */
   protected function loadResource($uri, $reset = TRUE) {
     static $resources;
+
     if (isset($resources[$uri])) {
       return $resources[$uri];
     }
@@ -156,7 +161,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
       if (in_array('sample.png', $paths) && strpos($uri, 'styles')) {
         $public_id = 'styles/' . $style_name . '/' . $scheme . '/' . $public_id;
       }
-      $resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE));
+      $resource = cloudinary_stream_wrapper_resource($public_id, ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE]);
 
       if (!$resource || $resource['mode'] != CLOUDINARY_STREAM_WRAPPER_FILE) {
         return FALSE;
@@ -165,20 +170,6 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
       // It should be add width and height of original image as parameters.
       $data = cloudinary_stream_wrapper_transformation($style_name, $resource);
       if (!empty($data)) {
-        /*$trans = \Cloudinary::generate_transformation_string($data);
-        $trans = '/upload/' . trim($trans, '/') . '/';
-        $resource['url'] = str_replace('/upload/', $trans, $resource['url']);
-        $resource['secure_url'] = str_replace('/upload/', $trans, $resource['secure_url']);
-
-        // Calculate image width and height with Drupal Image style API.
-        $dimensions = array(
-          'width' => $resource['width'],
-          'height' => $resource['height'],
-        );
-        $style = ImageStyle::load($style_name);
-        $style->transformDimensions($dimensions, $ori_uri);
-        $resource = array_merge($resource, $dimensions);*/
-
         $data['sign_url'] = TRUE;
         $data['type'] = $resource['type'];
 
@@ -187,12 +178,11 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
         $original_data = $data;
 
         $resource['url'] = str_replace(',', '%2C', cloudinary_url_internal($path, $data));
-        /*
-         * In Cloudinary PHP library will decide if secure must be used
-         * based on the parameters in your server. We always want the secure_url
-         * to be HTTPS so we force secure to TRUE as $data is not used anymore
-         * after this.
-         */
+
+        // In Cloudinary PHP library will decide if secure must be used
+        // based on the parameters in your server. We always want the secure_url
+        // to be HTTPS so we force secure to TRUE as $data is not used anymore
+        // after this.
         $data = $original_data;
         $data['secure'] = TRUE;
         $resource['secure_url'] = str_replace(',', '%2C', cloudinary_url_internal($path, $data));
@@ -202,14 +192,24 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     }
     elseif (!$this->resource || $reset) {
       $public_id = $this->getPublicId($uri);
-      if ($this->resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE, 'type' => 'private'))) {
-        // Use Private image.
-      } elseif ($this->resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE, 'type' => 'public'))) {
-        // Use Public image.
-      } elseif ($this->resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW))) {
-        // Use raw image.
+
+      // Check private images.
+      $options = ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE, 'type' => 'private'];
+      $this->resource = cloudinary_stream_wrapper_resource($public_id, $options);
+
+      // Check public image.
+      if (!$this->resource) {
+        $options = ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE, 'type' => 'public'];
+        $this->resource = cloudinary_stream_wrapper_resource($public_id, $options);
+      }
+
+      // Check raw image.
+      if (!$this->resource) {
+        $options = ['resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW];
+        $this->resource = cloudinary_stream_wrapper_resource($public_id, $options);
       }
     }
+
     $resources[$uri] = $this->resource;
 
     return $resources[$uri];
@@ -257,7 +257,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
       return FALSE;
     }
 
-    $stat = array();
+    $stat = [];
     $stat[0] = $stat['dev'] = 0;
     $stat[1] = $stat['ino'] = 0;
     $stat[2] = $stat['mode'] = $resource['mode'];
@@ -280,7 +280,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
    */
   protected function flush() {
     $this->folderName = NULL;
-    $this->directoryList = array();
+    $this->directoryList = [];
     $this->streamData = NULL;
     $this->streamPointer = 0;
     $this->streamWrite = FALSE;
@@ -357,7 +357,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
   /**
    * Base implementation of getMimeType().
    */
-  static public function getMimeType($uri, $mapping = NULL) {
+  public static function getMimeType($uri, $mapping = NULL) {
     if (!isset($mapping)) {
       // The default file map, defined in file.mimetypes.inc is quite big.
       // We only load it when necessary.
@@ -365,7 +365,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     }
 
     $extension = '';
-    $file_parts = explode('.', \Drupal::service("file_system")->basename($uri));
+    $file_parts = explode('.', \Drupal::service('file_system')->basename($uri));
 
     // Remove the first part: a full filename should not match an extension.
     array_shift($file_parts);
@@ -375,6 +375,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     // - jpeg
     // - image.jpeg, and
     // - awesome.image.jpeg
+    // .
     while ($additional_part = array_pop($file_parts)) {
       $extension = strtolower($additional_part . ($extension ? '.' . $extension : ''));
       if (isset($mapping['extensions'][$extension])) {
@@ -495,7 +496,6 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     return TRUE;
   }
 
-
   /**
    * Change stream options.
    *
@@ -641,7 +641,6 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     return $this->streamPointer >= strlen($this->streamData);
   }
 
-
   /**
    * Support for fseek().
    *
@@ -701,11 +700,11 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
         $dirname = '';
       }
 
-      $options = array(
+      $options = [
         'public_id' => $public_id,
         'resource_type' => $this->resourceType,
         'tags' => CLOUDINARY_STREAM_WRAPPER_FOLDER_TAG_PREFIX . $dirname,
-      );
+      ];
 
       if (cloudinary_stream_wrapper_create_file($base64_data, $options)) {
         // Unset resource of static variables after new file uploaded.
@@ -847,7 +846,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
    */
   public function dirname($uri = NULL) {
     list($scheme, $target) = explode('://', $uri, 2);
-    $target  = $this->getTarget($uri);
+    $target = $this->getTarget($uri);
     $dirname = dirname($target);
 
     if ($dirname == '.') {
@@ -943,7 +942,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
     $resource = $this->loadResource($uri);
 
     if ($resource) {
-      $list = array('.', '..');
+      $list = ['.', '..'];
 
       if (isset($this->resource['folders']) && !empty($this->resource['folders'])) {
         $list = array_merge($list, $this->resource['folders']);
@@ -1009,7 +1008,7 @@ class CloudinaryStreamWrapper implements StreamWrapperInterface {
    * @see http://php.net/manual/streamwrapper.dir-closedir.php
    */
   public function dir_closedir() {
-    $this->directoryList = array();
+    $this->directoryList = [];
 
     return TRUE;
   }
