diff --git a/gigya/css/gigya.css b/gigya/css/gigya.css
index 3d91d28..a9325d2 100755
--- a/gigya/css/gigya.css
+++ b/gigya/css/gigya.css
@@ -13,6 +13,3 @@
 .hidden {
   display: none;
 }
-
-
-
diff --git a/gigya/gigya.api.php b/gigya/gigya.api.php
index 58daf87..b0f00df 100755
--- a/gigya/gigya.api.php
+++ b/gigya/gigya.api.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Documentation for Gigya module APIs.
@@ -49,8 +50,6 @@ function hook_gigya_lang_alter(&$lang) {
   }
 }
 
-
-
 /**
  * @} End of "addtogroup hooks".
  */
diff --git a/gigya/gigya.install b/gigya/gigya.install
index 4906254..c6579a4 100755
--- a/gigya/gigya.install
+++ b/gigya/gigya.install
@@ -5,8 +5,6 @@
  * Installation functions for Gigya module.
  */
 
-use Drupal\Core\Config\FileStorage;
-use Drupal\Core\Database\Database;
 /**
  * Implements hook_install.
  */
@@ -14,6 +12,9 @@ function gigya_install() {
 
 }
 
+/**
+ *
+ */
 function gigya_uninstall() {
 
-}
\ No newline at end of file
+}
diff --git a/gigya/gigya.module b/gigya/gigya.module
index 70c6f07..0a7d087 100755
--- a/gigya/gigya.module
+++ b/gigya/gigya.module
@@ -1,15 +1,21 @@
 <?php
+
+/**
+ * @file
+ */
+
 use Drupal\gigya\Helper\GigyaHelper;
 
 /**
  * Implements hook_page_attachments().
+ *
  * @param array $attachments
  */
 function gigya_page_attachments(array &$attachments) {
-  //Check for api key.
+  // Check for api key.
   $api_key = \Drupal::config('gigya.settings')->get('gigya.gigya_api_key');
   if (!empty($api_key)) {
-    //Add gigya params to drupalSettings.
+    // Add gigya params to drupalSettings.
     $global_params = \Drupal::config('gigya.global')->get('gigya.globalParameters');
     \Drupal::moduleHandler()->alter('gigya_global_parameters', $global_params);
 
@@ -18,7 +24,7 @@ function gigya_page_attachments(array &$attachments) {
     $attachments['#attached']['drupalSettings']['gigya']['dataCenter'] = \Drupal::config('gigya.settings')->get('gigya.gigya_data_center');
 
     $lang = \Drupal::config('gigya.global')->get('gigya.language');
-    //Check if lang is in auto mode.
+    // Check if lang is in auto mode.
     if (strtolower($lang) == 'auto') {
       $lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
 
@@ -27,7 +33,7 @@ function gigya_page_attachments(array &$attachments) {
       $languages = $helper->getGigyaLanguages();
 
       if (!array_key_exists($lang, $languages)) {
-        //If we do not have the lang in gigya set the lang to the fallback.
+        // If we do not have the lang in gigya set the lang to the fallback.
         $lang = \Drupal::config('gigya.global')->get('gigya.languageFallback');
       }
     }
@@ -38,4 +44,4 @@ function gigya_page_attachments(array &$attachments) {
     // Add Library.
     $attachments['#attached']['library'][] = 'gigya/drupalGigya';
   }
-}
\ No newline at end of file
+}
diff --git a/gigya/src/Form/GigyaKeysForm.php b/gigya/src/Form/GigyaKeysForm.php
index 694dc04..24b08c9 100755
--- a/gigya/src/Form/GigyaKeysForm.php
+++ b/gigya/src/Form/GigyaKeysForm.php
@@ -1,10 +1,5 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\gigya\Form\GigyaKeysForm.
- */
-
 namespace Drupal\gigya\Form;
 
 use Drupal;
@@ -14,219 +9,244 @@ use Drupal\gigya\Helper\GigyaHelper;
 use Drupal\gigya\Helper\GigyaHelperInterface;
 use Gigya\CmsStarterKit\sdk\GSObject;
 
-class GigyaKeysForm extends ConfigFormBase
-{
-    /**
-     * @var Drupal\gigya\Helper\GigyaHelperInterface
-     */
-    public $helper = false;
-
-	/**
-     * Gets the configuration names that will be editable.
-     *
-     * @return array
-     *   An array of configuration object names that are editable if called in
-     *   conjunction with the trait's config() method.
-     */
-    protected function getEditableConfigNames()
-    {
-        return [
-            'gigya.settings',
-        ];
-    }
-
-    /**
-     * @param array $form
-     * @param \Drupal\Core\Form\FormStateInterface $form_state
-     * @param GigyaHelperInterface $helper
-     * @return array
-     */
-    public function buildForm(array $form, FormStateInterface $form_state, GigyaHelperInterface $helper = NULL)
-    {
-        // Form constructor
-
-        if ($helper == NULL) {
-            $this->helper = new GigyaHelper();
-        } else {
-            $this->helper = $helper;
-        }
-        if (!$this->helper->checkEncryptKey()) {
-        	$messenger = \Drupal::service('messenger');
-        	$messenger->addError($this->t('Cannot read encryption key. Either the file path is incorrect or the file is empty.'));
-        }
-        $form = parent::buildForm($form, $form_state);
-        $config = $this->config('gigya.settings');
-        $form['gigya_api_key'] = array('#type' => 'textfield', '#title' => $this->t('Gigya API Key'),
-            '#description' => $this->t('Specify the Gigya API Key for this domain'),
-            '#default_value' => $config->get('gigya.gigya_api_key'), '#required' => TRUE);
-
-        $form['gigya_application_key'] = array('#type' => 'textfield', '#title' => $this->t('Gigya Application Key'),
-            '#description' => $this->t('Specify the Gigya Application key for this domain'),
-            '#default_value' => $config->get('gigya.gigya_application_key'), '#required' => TRUE);
-        $key = $config->get('gigya.gigya_application_secret_key');
-        $access_key = "";
-        if (!empty($key)) {
-            $access_key = $this->helper->decrypt($key);
-        }
-
-        $form['gigya_application_secret_key'] = array('#type' => 'textfield', '#title' => $this->t('Gigya Application Secret Key'));
-        $form['gigya_application_secret_key']['#description'] = $this->t('Specify the Gigya Application Secret Key for this domain');
-		$form['gigya_application_secret_key']['#attributes'] = array(
-			'autocomplete' => 'off'
-		);
-        if (empty($access_key)) {
-            $form['gigya_application_secret_key']['#required'] = TRUE;
-        } else {
-            $form['gigya_application_secret_key']['#default_value'] = "*********";
-            $form['gigya_application_secret_key']['#required'] = FALSE;
-            $form['gigya_application_secret_key']['#description'] .= $this->t(". Current key first and last letters are @accessKey", array('@accessKey' => substr($access_key, 0, 2) . "****" .
-                substr($access_key, strlen($access_key) - 2, 2)));
-        }
-
-        $data_centers = array('us1.gigya.com' => 'US', 'eu1.gigya.com' => 'EU', 'au1.gigya.com' => 'AU', 'ru1.gigya.com' => 'RU', 'cn1.gigya-api.cn' => 'CN', 'other' => "Other");
-        $form['gigya_data_center'] = array(
-            '#type' => 'select',
-            '#title' => $this->t('Data Center'),
-            '#description' => $this->t('Please select the Gigya data center in which your site is defined. To verify your site location contact your Gigya implementation manager.'),
-            '#options' => $data_centers,
-            '#default_value' => array_key_exists($config->get('gigya.gigya_data_center'), $data_centers) ? $config->get('gigya.gigya_data_center') : 'other'
-        );
-
-		$form['gigya_other_data_center'] = array(
-            "#type" => "textfield",
-            "#default_value" => $config->get('gigya.gigya_data_center'),
-            "#attributes" => array("id" => "gigya-other-data-center"),
-            '#states' => array(
-                'visible' => array(
-                    ':input[name="gigya_data_center"]' => array('value' => 'other'),
-                ),
-            ),
-        );
-
-        return $form;
-
-    }
-
-    /**
-     * Returns a unique string identifying the form.
-     *
-     * @return string
-     *   The unique string identifying the form.
-     */
-    public function getFormId()
-    {
-        return 'gigya_admin_keys';
-
-    }
-
-    public function validateForm(array &$form, FormStateInterface $form_state)
-    {
-        parent::validateForm($form, $form_state);
-        //Encrypt key error.
-        if (!$this->helper->checkEncryptKey()) {
-            $form_state->setErrorByName('gigya_api_key', "");
-            return;
-        }
-        //Check if the form has errors, if true we do not need to validate the user input because it has errors already.
-        if ($form_state->getErrors()) {
-
-            return;
-        }
-
-        $config = $this->config('gigya.settings');
-
-        // API key was changed ?
-        if ($this->getValue($form_state, 'gigya_api_key') != $config->get('gigya.gigya_api_key')) {
-            $_gigya_api_key = $this->getValue($form_state, 'gigya_api_key');
-        } else {
-            $_gigya_api_key = $config->get('gigya.gigya_api_key');
-        }
-
-        // APP key was changed ?
-        if ($this->getValue($form_state, 'gigya_application_key') != $config->get('gigya.gigya_application_key')) {
-            $_gigya_application_key = $this->getValue($form_state, 'gigya_application_key');
-        } else {
-            $_gigya_application_key = $config->get('gigya.gigya_application_key');
-        }
-
-        // APP secret key was changed ?
-        $temp_access_key = $this->getValue($form_state, 'gigya_application_secret_key');
-        if (!empty($temp_access_key) && $temp_access_key !== "*********") {
-            $_gigya_application_secret_key = $temp_access_key;
-        } else {
-            $key = $config->get('gigya.gigya_application_secret_key');
-            if (!empty($key)) {
-                $_gigya_application_secret_key = $this->helper->decrypt($key);
-            } else {
-                $_gigya_application_secret_key = "";
-            }
-        }
-
-        // Data Center was changed ?
-        if ($this->getValue($form_state, 'gigya_data_center') != $config->get('gigya.gigya_data_center') || $this->getValue($form_state, 'gigya_other_data_center') != $config->get('gigya.gigya_other_data_center')) {
-            if ($this->getValue($form_state, 'gigya_data_center') == 'other') {
-                $_gigya_data_center = $this->getValue($form_state, 'gigya_other_data_center');
-            } else {
-                $_gigya_data_center = $this->getValue($form_state, 'gigya_data_center');
-            }
-        } else {
-            $_gigya_data_center = $config->get('gigya.gigya_data_center');
-        }
-        $access_params = array();
-        $access_params['api_key'] = $_gigya_api_key;
-        $access_params['app_secret'] = $_gigya_application_secret_key;
-        $access_params['app_key'] = $_gigya_application_key;
-        $access_params['data_center'] = $_gigya_data_center;
-        $params = new GSObject();
-        $params->put('url', 'http://www.gigya.com');
-
-        $res = $this->helper->sendApiCall('shortenURL', $params, $access_params);
-        $valid = FALSE;
-        if ($res->getErrorCode() == 0) {
-            $valid = TRUE;
-        }
-        if ($valid !== TRUE) {
-            if (is_object($res)) {
-                $code = $res->getErrorCode();
-                $msg = $res->getMessage();
-                //@TODO: see how we can print markup in the error messages.
-
-                $form_state->setErrorByName('gigya_api_key', $this->t("Gigya API error: {$code} - {$msg}.") .
-                    "For more information please refer to <a href=http://developers.gigya.com/037_API_reference/zz_Response_Codes_and_Errors target=_blank>Response_Codes_and_Errors page</a>");
-                Drupal::logger('gigya')->error('Error setting API key, error code: @code - @msg', array('@code' => $code, '@msg' => $msg));
-            } else {
-                $form_state->setErrorByName('gigya_api_key', $this->t("Your API key or Secret key could not be validated. Please try again"));
-            }
-        } else {
-            drupal_set_message($this->t('Gigya validated properly. This site is authorized to use Gigya services'));
-
-        }
-    }
-
-    public function submitForm(array &$form, FormStateInterface $form_state)
-    {
-        $config = $this->config('gigya.settings');
-        $config->set('gigya.gigya_application_key', $this->getValue($form_state, 'gigya_application_key'));
-        $config->set('gigya.gigya_api_key', $this->getValue($form_state, 'gigya_api_key'));
-        $temp_access_key = $this->getValue($form_state, 'gigya_application_secret_key');
-        if (!empty($temp_access_key) && $temp_access_key !== "*********") {
-            $enc = $this->helper->enc($temp_access_key);
-            $config->set('gigya.gigya_application_secret_key', $enc);
-        }
-
-        if ($this->getValue($form_state, 'gigya_data_center') == 'other') {
-            $config->set('gigya.gigya_data_center', $this->getValue($form_state, 'gigya_other_data_center'));
-        } else {
-            $config->set('gigya.gigya_data_center', $this->getValue($form_state, 'gigya_data_center'));
-        }
-
-        $config->save();
-        parent::submitForm($form, $form_state);
-    }
-
-    private function getValue($form_state, $prop_name)
-    {
-        return trim($form_state->getValue($prop_name));
+/**
+ *
+ */
+class GigyaKeysForm extends ConfigFormBase {
+  /**
+   * @var \Drupal\gigya\Helper\GigyaHelperInterface
+   */
+  public $helper = FALSE;
+
+  /**
+   * Gets the configuration names that will be editable.
+   *
+   * @return array
+   *   An array of configuration object names that are editable if called in
+   *   conjunction with the trait's config() method.
+   */
+  protected function getEditableConfigNames() {
+    return [
+      'gigya.settings',
+    ];
+  }
+
+  /**
+   * @param array $form
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   * @param \Drupal\gigya\Helper\GigyaHelperInterface $helper
+   * @return array
+   */
+  public function buildForm(array $form, FormStateInterface $form_state, GigyaHelperInterface $helper = NULL) {
+    // Form constructor.
+    if ($helper == NULL) {
+      $this->helper = new GigyaHelper();
+    }
+    else {
+      $this->helper = $helper;
+    }
+    if (!$this->helper->checkEncryptKey()) {
+      $messenger = \Drupal::service('messenger');
+      $messenger->addError($this->t('Cannot read encryption key. Either the file path is incorrect or the file is empty.'));
+    }
+    $form = parent::buildForm($form, $form_state);
+    $config = $this->config('gigya.settings');
+    $form['gigya_api_key'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Gigya API Key'),
+      '#description' => $this->t('Specify the Gigya API Key for this domain'),
+      '#default_value' => $config->get('gigya.gigya_api_key'),
+      '#required' => TRUE,
+    ];
+
+    $form['gigya_application_key'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Gigya Application Key'),
+      '#description' => $this->t('Specify the Gigya Application key for this domain'),
+      '#default_value' => $config->get('gigya.gigya_application_key'),
+      '#required' => TRUE,
+    ];
+    $key = $config->get('gigya.gigya_application_secret_key');
+    $access_key = "";
+    if (!empty($key)) {
+      $access_key = $this->helper->decrypt($key);
+    }
+
+    $form['gigya_application_secret_key'] = ['#type' => 'textfield', '#title' => $this->t('Gigya Application Secret Key')];
+    $form['gigya_application_secret_key']['#description'] = $this->t('Specify the Gigya Application Secret Key for this domain');
+    $form['gigya_application_secret_key']['#attributes'] = [
+      'autocomplete' => 'off',
+    ];
+    if (empty($access_key)) {
+      $form['gigya_application_secret_key']['#required'] = TRUE;
+    }
+    else {
+      $form['gigya_application_secret_key']['#default_value'] = "*********";
+      $form['gigya_application_secret_key']['#required'] = FALSE;
+      $form['gigya_application_secret_key']['#description'] .= $this->t(". Current key first and last letters are @accessKey", [
+        '@accessKey' => substr($access_key, 0, 2) . "****" .
+        substr($access_key, strlen($access_key) - 2, 2),
+      ]);
+    }
+
+    $data_centers = ['us1.gigya.com' => 'US', 'eu1.gigya.com' => 'EU', 'au1.gigya.com' => 'AU', 'ru1.gigya.com' => 'RU', 'cn1.gigya-api.cn' => 'CN', 'other' => "Other"];
+    $form['gigya_data_center'] = [
+      '#type' => 'select',
+      '#title' => $this->t('Data Center'),
+      '#description' => $this->t('Please select the Gigya data center in which your site is defined. To verify your site location contact your Gigya implementation manager.'),
+      '#options' => $data_centers,
+      '#default_value' => array_key_exists($config->get('gigya.gigya_data_center'), $data_centers) ? $config->get('gigya.gigya_data_center') : 'other',
+    ];
+
+    $form['gigya_other_data_center'] = [
+      "#type" => "textfield",
+      "#default_value" => $config->get('gigya.gigya_data_center'),
+      "#attributes" => ["id" => "gigya-other-data-center"],
+      '#states' => [
+        'visible' => [
+          ':input[name="gigya_data_center"]' => ['value' => 'other'],
+        ],
+      ],
+    ];
+
+    return $form;
+
+  }
+
+  /**
+   * Returns a unique string identifying the form.
+   *
+   * @return string
+   *   The unique string identifying the form.
+   */
+  public function getFormId() {
+    return 'gigya_admin_keys';
+
+  }
+
+  /**
+   *
+   */
+  public function validateForm(array &$form, FormStateInterface $form_state) {
+    parent::validateForm($form, $form_state);
+    // Encrypt key error.
+    if (!$this->helper->checkEncryptKey()) {
+      $form_state->setErrorByName('gigya_api_key', "");
+      return;
+    }
+    // Check if the form has errors, if true we do not need to validate the user input because it has errors already.
+    if ($form_state->getErrors()) {
+
+      return;
+    }
+
+    $config = $this->config('gigya.settings');
+
+    // API key was changed ?
+    if ($this->getValue($form_state, 'gigya_api_key') != $config->get('gigya.gigya_api_key')) {
+      $_gigya_api_key = $this->getValue($form_state, 'gigya_api_key');
+    }
+    else {
+      $_gigya_api_key = $config->get('gigya.gigya_api_key');
     }
-}
 
+    // APP key was changed ?
+    if ($this->getValue($form_state, 'gigya_application_key') != $config->get('gigya.gigya_application_key')) {
+      $_gigya_application_key = $this->getValue($form_state, 'gigya_application_key');
+    }
+    else {
+      $_gigya_application_key = $config->get('gigya.gigya_application_key');
+    }
+
+    // APP secret key was changed ?
+    $temp_access_key = $this->getValue($form_state, 'gigya_application_secret_key');
+    if (!empty($temp_access_key) && $temp_access_key !== "*********") {
+      $_gigya_application_secret_key = $temp_access_key;
+    }
+    else {
+      $key = $config->get('gigya.gigya_application_secret_key');
+      if (!empty($key)) {
+        $_gigya_application_secret_key = $this->helper->decrypt($key);
+      }
+      else {
+        $_gigya_application_secret_key = "";
+      }
+    }
+
+    // Data Center was changed ?
+    if ($this->getValue($form_state, 'gigya_data_center') != $config->get('gigya.gigya_data_center') || $this->getValue($form_state, 'gigya_other_data_center') != $config->get('gigya.gigya_other_data_center')) {
+      if ($this->getValue($form_state, 'gigya_data_center') == 'other') {
+        $_gigya_data_center = $this->getValue($form_state, 'gigya_other_data_center');
+      }
+      else {
+        $_gigya_data_center = $this->getValue($form_state, 'gigya_data_center');
+      }
+    }
+    else {
+      $_gigya_data_center = $config->get('gigya.gigya_data_center');
+    }
+    $access_params = [];
+    $access_params['api_key'] = $_gigya_api_key;
+    $access_params['app_secret'] = $_gigya_application_secret_key;
+    $access_params['app_key'] = $_gigya_application_key;
+    $access_params['data_center'] = $_gigya_data_center;
+    $params = new GSObject();
+    $params->put('url', 'http://www.gigya.com');
+
+    $res = $this->helper->sendApiCall('shortenURL', $params, $access_params);
+    $valid = FALSE;
+    if ($res->getErrorCode() == 0) {
+      $valid = TRUE;
+    }
+    if ($valid !== TRUE) {
+      if (is_object($res)) {
+        $code = $res->getErrorCode();
+        $msg = $res->getMessage();
+        // @TODO: see how we can print markup in the error messages.
+
+        $form_state->setErrorByName('gigya_api_key', $this->t("Gigya API error: {$code} - {$msg}.") .
+        "For more information please refer to <a href=http://developers.gigya.com/037_API_reference/zz_Response_Codes_and_Errors target=_blank>Response_Codes_and_Errors page</a>");
+        Drupal::logger('gigya')->error('Error setting API key, error code: @code - @msg', ['@code' => $code, '@msg' => $msg]);
+      }
+      else {
+        $form_state->setErrorByName('gigya_api_key', $this->t("Your API key or Secret key could not be validated. Please try again"));
+      }
+    }
+    else {
+      drupal_set_message($this->t('Gigya validated properly. This site is authorized to use Gigya services'));
+
+    }
+  }
+
+  /**
+   *
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $config = $this->config('gigya.settings');
+    $config->set('gigya.gigya_application_key', $this->getValue($form_state, 'gigya_application_key'));
+    $config->set('gigya.gigya_api_key', $this->getValue($form_state, 'gigya_api_key'));
+    $temp_access_key = $this->getValue($form_state, 'gigya_application_secret_key');
+    if (!empty($temp_access_key) && $temp_access_key !== "*********") {
+      $enc = $this->helper->enc($temp_access_key);
+      $config->set('gigya.gigya_application_secret_key', $enc);
+    }
+
+    if ($this->getValue($form_state, 'gigya_data_center') == 'other') {
+      $config->set('gigya.gigya_data_center', $this->getValue($form_state, 'gigya_other_data_center'));
+    }
+    else {
+      $config->set('gigya.gigya_data_center', $this->getValue($form_state, 'gigya_data_center'));
+    }
+
+    $config->save();
+    parent::submitForm($form, $form_state);
+  }
+
+  /**
+   *
+   */
+  private function getValue($form_state, $prop_name) {
+    return trim($form_state->getValue($prop_name));
+  }
+
+}
diff --git a/gigya/src/Helper/GigyaHelper.php b/gigya/src/Helper/GigyaHelper.php
index c495616..b4e2b3a 100755
--- a/gigya/src/Helper/GigyaHelper.php
+++ b/gigya/src/Helper/GigyaHelper.php
@@ -1,16 +1,11 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\gigya\Helper\GigyaHelper.
- */
-
 namespace Drupal\gigya\Helper;
 
+use Drupal\user\UserInterface;
 use Drupal;
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Database\Database;
-use Drupal\user\Entity\User;
 use Exception;
 use Gigya\CmsStarterKit\GigyaApiHelper;
 use Gigya\CmsStarterKit\sdk\GigyaApiRequest;
@@ -21,13 +16,17 @@ use Gigya\CmsStarterKit\user\GigyaUser;
 use Gigya\CmsStarterKit\user\GigyaUserFactory;
 use Gigya\CmsStarterKit\ds\DsQueryObject;
 
+/**
+ *
+ */
 class GigyaHelper implements GigyaHelperInterface {
-    /**
-     * @param $obj
-     * @param $keys
-     *
-     * @return null | string
-     */
+
+  /**
+   * @param $obj
+   * @param $keys
+   *
+   * @return null | string
+   */
   public function getNestedValue($obj, $keys) {
     while (!empty($keys)) {
       $key = array_shift($keys);
@@ -36,7 +35,7 @@ class GigyaHelper implements GigyaHelperInterface {
         $method = "get" . ucfirst($key);
         $obj = $obj->$method();
       }
-      else if (is_array($obj)) {
+      elseif (is_array($obj)) {
         if (array_key_exists($key, $obj)) {
           $obj = $obj[$key];
         }
@@ -56,14 +55,23 @@ class GigyaHelper implements GigyaHelperInterface {
     return $obj;
   }
 
+  /**
+   *
+   */
   public function enc($str) {
     return GigyaApiHelper::enc($str, $this->getEncryptKey());
   }
 
+  /**
+   *
+   */
   public function decrypt($str) {
     return GigyaApiHelper::decrypt($str, $this->getEncryptKey());
   }
 
+  /**
+   *
+   */
   public function checkEncryptKey() {
     $keypath = \Drupal::config('gigya.global')->get('gigya.keyPath');
     $key = $this->getEncKeyFile($keypath);
@@ -75,26 +83,31 @@ class GigyaHelper implements GigyaHelperInterface {
     }
   }
 
+  /**
+   *
+   */
   public function getEncryptKey() {
-  	$path = \Drupal::config('gigya.global')->get('gigya.keyPath');
+    $path = \Drupal::config('gigya.global')->get('gigya.keyPath');
     $keypath = $this->getEncKeyFile($path);
-    try
-	{
-		if ($key = trim(file_get_contents($keypath))) {
-			if (!empty($key))
-				return $key;
-		}
-		return false;
-	}
-	catch (Exception $e)
-	{
-		\Drupal::logger('gigya')->error('Key file not found. Configure the correct path in your gigya.global TML file.');
-		return false;
-	}
+    try {
+      if ($key = trim(file_get_contents($keypath))) {
+        if (!empty($key)) {
+          return $key;
+        }
+      }
+      return FALSE;
+    }
+    catch (Exception $e) {
+      \Drupal::logger('gigya')->error('Key file not found. Configure the correct path in your gigya.global TML file.');
+      return FALSE;
+    }
   }
 
+  /**
+   *
+   */
   public function getAccessParams() {
-    $access_params = array();
+    $access_params = [];
     $key = $this->getEncryptKey();
 
     $access_params['api_key'] = Drupal::config('gigya.settings')->get('gigya.gigya_api_key');
@@ -104,21 +117,21 @@ class GigyaHelper implements GigyaHelperInterface {
     return $access_params;
   }
 
-	/**
-	 * @param      $method
-	 * @param null $params
-	 * @param bool $access_params
-	 *
-	 * @return Exception|GSApiException|\Gigya\CmsStarterKit\sdk\GSResponse
-	 *
-	 * @throws \Exception
-	 */
-  public function sendApiCall($method, $params = null, $access_params = FALSE) {
+  /**
+   * @param      $method
+   * @param null $params
+   * @param bool $access_params
+   *
+   * @return \Exception|GSApiException|\Gigya\CmsStarterKit\sdk\GSResponse
+   *
+   * @throws \Exception
+   */
+  public function sendApiCall($method, $params = NULL, $access_params = FALSE) {
     try {
       if (!$access_params) {
         $access_params = $this->getAccessParams();
       }
-      if ($params == null) {
+      if ($params == NULL) {
         $params = new GSObject();
       }
 
@@ -127,57 +140,71 @@ class GigyaHelper implements GigyaHelperInterface {
       $request = new GigyaApiRequest($access_params['api_key'], $access_params['app_secret'], $method, $params, $access_params['data_center'], TRUE, $access_params['app_key']);
 
       $result = $request->send();
-      if (Drupal::config('gigya.global')->get('gigya.gigyaDebugMode') == true) {
+      if (Drupal::config('gigya.global')->get('gigya.gigyaDebugMode') == TRUE) {
 
-        // on first module load, api & secret are empty, so no values in response
+        // On first module load, api & secret are empty, so no values in response.
         Drupal::logger('gigya')->debug('Response from gigya <br /><pre>callId: @callId, apicall:@method</pre>',
-                                                array('@callId' => $result->getData()->getString('callId'), '@method' => $method));
+                                                ['@callId' => $result->getData()->getString('callId'), '@method' => $method]);
       }
       return $result;
-    } catch (GSApiException $e) {
-      //Always write error to log.
+    }
+    catch (GSApiException $e) {
+      // Always write error to log.
       Drupal::logger('gigya')->error('<pre>Gigya API error. Error code :' . $e->getErrorCode() . '</pre>');
       if ($e->getCallId()) {
 
         Drupal::logger('gigya')->error('Response from Gigya <br /><pre>Call ID: @callId, apicall:@method,
-                                                 Error:@error</pre>', array('@callId' => $e->getCallId(),
-                                                '@method' => $method, '@error' => $e->getErrorCode()));
+                                                 Error:@error</pre>', [
+                                                   '@callId' => $e->getCallId(),
+                                                   '@method' => $method,
+                                                   '@error' => $e->getErrorCode(),
+                                                 ]);
       }
 
       return $e;
     }
   }
 
-	/**
-	 * @param $uid
-	 * @param $uid_sig
-	 * @param $sig_timestamp
-	 * @return bool | GigyaUser
-	 */
+  /**
+   * @param $uid
+   * @param $uid_sig
+   * @param $sig_timestamp
+   * @return bool | GigyaUser
+   */
   public function validateUid($uid, $uid_sig, $sig_timestamp) {
     try {
-      $params = array('environment' => $this->getEnvString());
+      $params = ['environment' => $this->getEnvString()];
 
       return $this->getGigyaApiHelper()->validateUid($uid, $uid_sig, $sig_timestamp, NULL, NULL, $params);
-    } catch (GSApiException $e) {
-      Drupal::logger('gigya')->error("Gigya API call error: @error, Call ID: @callId", array('@callId' => $e->getCallId(), '@error' => $e->getMessage()));
-      return false;
+    }
+    catch (GSApiException $e) {
+      Drupal::logger('gigya')->error("Gigya API call error: @error, Call ID: @callId", ['@callId' => $e->getCallId(), '@error' => $e->getMessage()]);
+      return FALSE;
     }
     catch (Exception $e) {
       Drupal::logger('gigya')->error("General error validating gigya UID: " . $e->getMessage());
-      return false;
+      return FALSE;
     }
   }
 
+  /**
+   *
+   */
   public function getGigyaApiHelper() {
     $access_params = $this->getAccessParams();
     return new GigyaApiHelper($access_params['api_key'], $access_params['app_key'], $access_params['app_secret'], $access_params['data_center']);
   }
 
+  /**
+   *
+   */
   public function getGigyaDsQuery() {
     return new DsQueryObject($this->getGigyaApiHelper());
   }
 
+  /**
+   *
+   */
   public function setDsData($uid, $type, $oid, $data) {
     $params = [];
     $params['type'] = $type;
@@ -188,6 +215,9 @@ class GigyaHelper implements GigyaHelperInterface {
     return $res;
   }
 
+  /**
+   *
+   */
   public function doSingleDsGet($type, $oid, $fields, $uid) {
     $dsQueryObj = $this->getGigyaDsQuery();
     $dsQueryObj->setOid($oid);
@@ -198,6 +228,9 @@ class GigyaHelper implements GigyaHelperInterface {
     return $res->serialize()['data'];
   }
 
+  /**
+   *
+   */
   public function doSingleDsSearch($type, $oid, $fields, $uid) {
     $dsQueryObj = $this->getGigyaDsQuery();
     $dsQueryObj->setFields($fields);
@@ -208,8 +241,11 @@ class GigyaHelper implements GigyaHelperInterface {
     return $this->dsProcessSearch($res);
   }
 
+  /**
+   *
+   */
   private function dsProcessSearch($results) {
-    $processed = array();
+    $processed = [];
     foreach ($results as $result) {
       if (isset($result['data']) && is_array($result['data'])) {
         $processed += $result['data'];
@@ -218,34 +254,43 @@ class GigyaHelper implements GigyaHelperInterface {
     return $processed;
   }
 
+  /**
+   *
+   */
   public function saveUserLogoutCookie() {
-    user_cookie_save(array('gigya' => 'gigyaLogOut'));
+    user_cookie_save(['gigya' => 'gigyaLogOut']);
   }
 
+  /**
+   *
+   */
   public function getUidByMail($mail) {
     return \Drupal::entityQuery('user')
-      ->condition('mail',  $mail)
+      ->condition('mail', $mail)
       ->execute();
   }
 
+  /**
+   *
+   */
   public function getUidByMails($mails) {
     return \Drupal::entityQuery('user')
-      ->condition('mail',  $mails)
+      ->condition('mail', $mails)
       ->execute();
   }
 
   /**
    * @param $uuid
    *
-   * @return User
+   * @return \Drupal\user\Entity\User
    */
   public function getUidByUUID($uuid) {
     return \Drupal::service('entity.repository')->loadEntityByUuid('user', $uuid);
   }
 
   /**
-   * @param GigyaUser $gigyaUser
-   * @param integer   $uid
+   * @param \Gigya\CmsStarterKit\user\GigyaUser $gigyaUser
+   * @param int $uid
    *
    * @return bool
    */
@@ -266,6 +311,9 @@ class GigyaHelper implements GigyaHelperInterface {
     return FALSE;
   }
 
+  /**
+   *
+   */
   public function checkProfileEmail($profile_email, $loginIds) {
     $exists = FALSE;
     foreach ($loginIds as $id) {
@@ -276,22 +324,28 @@ class GigyaHelper implements GigyaHelperInterface {
     return $exists;
   }
 
+  /**
+   *
+   */
   public function getUidByName($name) {
     return \Drupal::entityQuery('user')
-      ->condition('name',  Database::getConnection()->escapeLike($name), 'LIKE')
+      ->condition('name', Database::getConnection()->escapeLike($name), 'LIKE')
       ->execute();
   }
 
-  public function processFieldMapping($gigya_data, Drupal\user\UserInterface $drupal_user) {
+  /**
+   *
+   */
+  public function processFieldMapping($gigya_data, UserInterface $drupal_user) {
     try {
       $field_map = \Drupal::config('gigya.global')->get('gigya.fieldMapping');
       try {
-	      \Drupal::moduleHandler()
-	        ->alter('gigya_raas_map_data', $gigya_data, $drupal_user, $field_map);
+        \Drupal::moduleHandler()
+          ->alter('gigya_raas_map_data', $gigya_data, $drupal_user, $field_map);
       }
       catch (Exception $e) {
-	      Drupal::logger('gigya')->debug('Error altering field map data: @message',
-	                                     array('@message' => $e->getMessage()));
+        Drupal::logger('gigya')->debug('Error altering field map data: @message',
+                                         ['@message' => $e->getMessage()]);
       }
       foreach ($field_map as $drupal_field => $raas_field) {
         if ($drupal_field == 'mail' or $drupal_field == 'name') {
@@ -299,16 +353,15 @@ class GigyaHelper implements GigyaHelperInterface {
         }
         $raas_field_parts = explode(".", $raas_field);
         $val = $this->getNestedValue($gigya_data, $raas_field_parts);
-        if ($val !== null) {
-	        $drupal_field_type = 'string';
-            try {
-                $drupal_field_type = $drupal_user->get($drupal_field)->getFieldDefinition()->getType();
-	        }
-	        catch (Exception $e)
-	        {
-		        Drupal::logger('gigya')->debug('Error getting field definition for field map: @message',
-		                                       array('@message' => $e->getMessage()));
-	        }
+        if ($val !== NULL) {
+          $drupal_field_type = 'string';
+          try {
+            $drupal_field_type = $drupal_user->get($drupal_field)->getFieldDefinition()->getType();
+          }
+          catch (Exception $e) {
+            Drupal::logger('gigya')->debug('Error getting field definition for field map: @message',
+                                               ['@message' => $e->getMessage()]);
+          }
           if ($drupal_field_type == 'boolean') {
             if (is_bool($val)) {
               $val = intval($val);
@@ -319,59 +372,114 @@ class GigyaHelper implements GigyaHelperInterface {
           }
           try {
             $drupal_user->set($drupal_field, $val);
-          } catch (Exception $e) {
-	        Drupal::logger('gigya')->debug('Error inserting mapped field: @message',
-	                                         array('@message' => $e->getMessage()));
+          }
+          catch (Exception $e) {
+            Drupal::logger('gigya')->debug('Error inserting mapped field: @message',
+                                             ['@message' => $e->getMessage()]);
           }
         }
       }
-    } catch (Exception $e) {
+    }
+    catch (Exception $e) {
       Drupal::logger('gigya')->debug('processFieldMapping error @message',
-        array('@message' => $e->getMessage()));
+        ['@message' => $e->getMessage()]);
     }
   }
 
+  /**
+   *
+   */
   public function getGigyaUserFromArray($data) {
     return GigyaUserFactory::createGigyaProfileFromArray($data);
   }
 
+  /**
+   *
+   */
   public function getGigyaLanguages() {
 
-    return array("en" => "English (default)","ar" => "Arabic","br" => "Bulgarian","ca" => "Catalan","hr" => "Croatian",
-                "cs" => "Czech","da" => "Danish","nl" => "Dutch","fi" => "Finnish","fr" => "French","de" => "German",
-                "el" => "Greek","he" => "Hebrew","hu" => "Hungarian","id" => "Indonesian (Bahasa)","it" => "Italian",
-                "ja" => "Japanese","ko" => "Korean","ms" => "Malay","no" => "Norwegian","fa" => "Persian (Farsi)",
-                "pl" => "Polish","pt" => "Portuguese","ro" => "Romanian","ru" => "Russian","sr" => "Serbian (Cyrillic)",
-                "sk" => "Slovak","sl" => "Slovenian","es" => "Spanish","sv" => "Swedish","tl" => "Tagalog","th" => "Thai",
-                "tr" => "Turkish","uk" => "Ukrainian","vi" => "Vietnamese","zh-cn" => "Chinese (Mandarin)","Chinese (Hong Kong)" => "zh-cn",
-                "zh-hk" => "Chinese (Hong Kong)","Chinese (Taiwan)" => "zh-hk","zh-tw" => "Chinese (Taiwan)","Croatian" => "zh-tw","nl-inf" => "Dutch Informal",
-                "Finnish" => "nl-inf","fr-inf" => "French Informal","German" => "fr-inf","de-inf" => "German Informal","Greek" => "de-inf",
-                "pt-br" => "Portuguese (Brazil)","Romanian" => "pt-br","es-inf" => "Spanish Informal","Spanish (Lat-Am)" => "es-inf",
-                "es-mx" => "Spanish (Lat-Am)","Swedish" => "es-mx");
+    return [
+      "en" => "English (default)",
+      "ar" => "Arabic",
+      "br" => "Bulgarian",
+      "ca" => "Catalan",
+      "hr" => "Croatian",
+      "cs" => "Czech",
+      "da" => "Danish",
+      "nl" => "Dutch",
+      "fi" => "Finnish",
+      "fr" => "French",
+      "de" => "German",
+      "el" => "Greek",
+      "he" => "Hebrew",
+      "hu" => "Hungarian",
+      "id" => "Indonesian (Bahasa)",
+      "it" => "Italian",
+      "ja" => "Japanese",
+      "ko" => "Korean",
+      "ms" => "Malay",
+      "no" => "Norwegian",
+      "fa" => "Persian (Farsi)",
+      "pl" => "Polish",
+      "pt" => "Portuguese",
+      "ro" => "Romanian",
+      "ru" => "Russian",
+      "sr" => "Serbian (Cyrillic)",
+      "sk" => "Slovak",
+      "sl" => "Slovenian",
+      "es" => "Spanish",
+      "sv" => "Swedish",
+      "tl" => "Tagalog",
+      "th" => "Thai",
+      "tr" => "Turkish",
+      "uk" => "Ukrainian",
+      "vi" => "Vietnamese",
+      "zh-cn" => "Chinese (Mandarin)",
+      "Chinese (Hong Kong)" => "zh-cn",
+      "zh-hk" => "Chinese (Hong Kong)",
+      "Chinese (Taiwan)" => "zh-hk",
+      "zh-tw" => "Chinese (Taiwan)",
+      "Croatian" => "zh-tw",
+      "nl-inf" => "Dutch Informal",
+      "Finnish" => "nl-inf",
+      "fr-inf" => "French Informal",
+      "German" => "fr-inf",
+      "de-inf" => "German Informal",
+      "Greek" => "de-inf",
+      "pt-br" => "Portuguese (Brazil)",
+      "Romanian" => "pt-br",
+      "es-inf" => "Spanish Informal",
+      "Spanish (Lat-Am)" => "es-inf",
+      "es-mx" => "Spanish (Lat-Am)",
+      "Swedish" => "es-mx",
+    ];
 
   }
 
   /**
    * @return string
-   *  the environment string to add to the API call.
+   *   the environment string to add to the API call.
    */
   public function getEnvString() {
     $info = system_get_info('module', 'gigya');
-    return '{"cms_name":"Drupal","cms_version":"Drupal_' . \Drupal::VERSION . '","gigya_version":"Gigya_module_' .$info['version'] . '"}';
+    return '{"cms_name":"Drupal","cms_version":"Drupal_' . \Drupal::VERSION . '","gigya_version":"Gigya_module_' . $info['version'] . '"}';
   }
 
-	/**
-	 * Gets real full path of the key even if only relative path is provided
-	 *
-	 * @param string	$uri	URI for the key, recommended to use full path
-	 * @return string
-	 */
+  /**
+   * Gets real full path of the key even if only relative path is provided.
+   *
+   * @param string $uri
+   *   URI for the key, recommended to use full path.
+   *
+   * @return string
+   */
   protected function getEncKeyFile($uri) {
-    /** @var Drupal\Core\StreamWrapper\StreamWrapperInterface $stream */
+    /** @var \Drupal\Core\StreamWrapper\StreamWrapperInterface $stream */
     $stream = \Drupal::service('stream_wrapper_manager')->getViaUri($uri);
     if ($stream == FALSE) {
       return realpath($uri);
     }
     return $stream->realpath();
   }
+
 }
diff --git a/gigya/src/Helper/GigyaHelperInterface.php b/gigya/src/Helper/GigyaHelperInterface.php
index ad4878a..9d16569 100755
--- a/gigya/src/Helper/GigyaHelperInterface.php
+++ b/gigya/src/Helper/GigyaHelperInterface.php
@@ -1,57 +1,101 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\gigya\Helper\GigyaHelperInterface.
- */
-
 namespace Drupal\gigya\Helper;
 
 use Drupal\user\UserInterface;
-use Gigya\CmsStarterKit\sdk\GSApiException;
-use Gigya\CmsStarterKit\sdk\GSResponse;
 
+/**
+ *
+ */
 interface GigyaHelperInterface {
+
+  /**
+   *
+   */
   public function getNestedValue($obj, $keys);
 
+  /**
+   *
+   */
   public function enc($str);
 
+  /**
+   *
+   */
   public function decrypt($str);
 
+  /**
+   *
+   */
   public function checkEncryptKey();
 
+  /**
+   *
+   */
   public function getEncryptKey();
 
+  /**
+   *
+   */
   public function getAccessParams();
 
-	/**
-	 * @param      $method
-	 * @param null $params
-	 * @param bool $access_params
-	 * @return \Exception|GSApiException|GSResponse
-	 */
-  public function sendApiCall($method, $params = null, $access_params = FALSE);
+  /**
+   * @param      $method
+   * @param null $params
+   * @param bool $access_params
+   * @return \Exception|GSApiException|GSResponse
+   */
+  public function sendApiCall($method, $params = NULL, $access_params = FALSE);
 
+  /**
+   *
+   */
   public function validateUid($uid, $uid_sig, $sig_timestamp);
 
+  /**
+   *
+   */
   public function getGigyaApiHelper();
 
+  /**
+   *
+   */
   public function saveUserLogoutCookie();
 
+  /**
+   *
+   */
   public function getUidByMail($mail);
 
+  /**
+   *
+   */
   public function getUidByUUID($uuid);
 
+  /**
+   *
+   */
   public function getUidByName($name);
 
+  /**
+   *
+   */
   public function processFieldMapping($gigya_data, UserInterface $drupal_user);
 
+  /**
+   *
+   */
   public function getGigyaUserFromArray($data);
 
+  /**
+   *
+   */
   public function getGigyaLanguages();
+
   /**
    * @return string
-   *  the environment string to add to the API call.
+   *   the environment string to add to the API call.
    */
   public function getEnvString();
+
 }
diff --git a/gigya/tests/src/Functional/GigyaTest.php b/gigya/tests/src/Functional/GigyaTest.php
index edd9795..4cf603c 100755
--- a/gigya/tests/src/Functional/GigyaTest.php
+++ b/gigya/tests/src/Functional/GigyaTest.php
@@ -1,107 +1,99 @@
 <?php
 
-	/**
-	 * @file
-	 * Contains \Drupal\Tests\gigya\Functional\GigyaTest.
-	 */
-
-	namespace Drupal\Tests\gigya\Functional;
-
-	use Drupal;
-	use Drupal\Core\Ajax\AjaxResponse;
-	use Drupal\Core\Ajax\AlertCommand;
-	use Drupal\Core\Ajax\RedirectCommand;
-	use Drupal\Core\Form\FormState;
-	use Drupal\gigya_raas\GigyaController;
-	use Drupal\Tests\BrowserTestBase;
-	use Drupal\User\Entity\User;
-	use Gigya\CmsStarterKit\sdk\GSApiException;
-	use Gigya\CmsStarterKit\sdk\GSResponse;
-	use Gigya\CmsStarterKit\user\GigyaUser;
-	use Gigya\CmsStarterKit\user\GigyaUserFactory;
-
-	/**
-	 * Tests Gigya module functionality.
-	 *
-	 * @group gigya
-	 */
-	class GigyaTest extends BrowserTestBase
-	{
-		/**
-		 * @var string $key
-		 */
-		private $key = "24c370c0d169a482ae1c5db1932b4b29";
-		/**
-		 * @var    GigyaController $gigyaControl
-		 */
-		private $gigyaControl;
-		private $requestMock;
-		/**
-		 * @var    AjaxResponse $successResponse
-		 */
-		private $successResponse;
-		private $trueKey = "24c370c0d169a482ae1c5db1932b4b29";
-
-		/**
-		 * Modules to enable.
-		 *
-		 * @var array
-		 */
-		public static $modules = array('gigya', 'gigya_raas');
-
-		/**
-		 * The user for tests.
-		 *
-		 * @var \Drupal\user\UserInterface
-		 */
-		protected $webUser;
-		/**
-		 * The user for tests.
-		 *
-		 * @var \Drupal\user\UserInterface
-		 */
-		protected $gigyaAdmin;
-		protected $helperMock;
-		/**
-		 * @var    GigyaUser $gigyaUser
-		 */
-		protected $gigyaUser;
-
-		/**
-		 * {@inheritdoc}
-		 */
-		public function setUp() {
-			parent::setUp();
-
-			$this->successResponse = new AjaxResponse();
-			$this->successResponse->addCommand(new RedirectCommand("/"));
-
-			$this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
-
-			$this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
-			$this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
-				->setMethods(array('getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'))
-				->getMock();
-			$this->helperMock->expects($this->any())->method('checkEncryptKey')->will($this->returnValue(TRUE));
-
-			$key = $this->trueKey;
-			$this->helperMock->expects($this->any())->method('getEncryptKey')->will($this->returnCallback(function() use ($key) {
-				return $this->key;
-			}));
-
-			$this->helperMock->expects($this->any())->method('validateUid')->will($this->returnCallback(function() use ($key) {
-				if ($this->key == $this->trueKey)
-				{
-					return $this->gigyaUser;
-				}
-				else
-				{
-					return false;
-				}
-			}));
-
-			$method = "accounts.getAccountInfo";
-			$json = '{
+namespace Drupal\Tests\gigya\Functional;
+
+use Drupal;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\AlertCommand;
+use Drupal\Core\Ajax\RedirectCommand;
+use Drupal\Core\Form\FormState;
+use Drupal\gigya_raas\GigyaController;
+use Drupal\Tests\BrowserTestBase;
+use Drupal\User\Entity\User;
+use Gigya\CmsStarterKit\sdk\GSApiException;
+use Gigya\CmsStarterKit\sdk\GSResponse;
+use Gigya\CmsStarterKit\user\GigyaUser;
+use Gigya\CmsStarterKit\user\GigyaUserFactory;
+
+/**
+ * Tests Gigya module functionality.
+ *
+ * @group gigya
+ */
+class GigyaTest extends BrowserTestBase {
+  /**
+   * @var string
+   */
+  private $key = "24c370c0d169a482ae1c5db1932b4b29";
+  /**
+   * @var    \Drupal\gigya_raas\GigyaController
+   */
+  private $gigyaControl;
+  private $requestMock;
+  /**
+   * @var    \Drupal\Core\Ajax\AjaxResponse
+   */
+  private $successResponse;
+  private $trueKey = "24c370c0d169a482ae1c5db1932b4b29";
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['gigya', 'gigya_raas'];
+
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $webUser;
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $gigyaAdmin;
+  protected $helperMock;
+  /**
+   * @var    \Gigya\CmsStarterKit\user\GigyaUser
+   */
+  protected $gigyaUser;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    $this->successResponse = new AjaxResponse();
+    $this->successResponse->addCommand(new RedirectCommand("/"));
+
+    $this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+
+    $this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
+    $this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
+      ->setMethods(['getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'])
+      ->getMock();
+    $this->helperMock->expects($this->any())->method('checkEncryptKey')->will($this->returnValue(TRUE));
+
+    $key = $this->trueKey;
+    $this->helperMock->expects($this->any())->method('getEncryptKey')->will($this->returnCallback(function () use ($key) {
+      return $this->key;
+    }));
+
+    $this->helperMock->expects($this->any())->method('validateUid')->will($this->returnCallback(function () use ($key) {
+      if ($this->key == $this->trueKey) {
+        return $this->gigyaUser;
+      }
+      else {
+        return FALSE;
+      }
+    }));
+
+    $method = "accounts.getAccountInfo";
+    $json = '{
   "UID": "_guid_-SPzNo7usObOUAUKT0KC-yijanD1CTN4n-syLkRjj5k=",
   "UIDSignature": "cTXiwusSZP3b/VpAZ9ik2PDvAI0=",
   "signatureTimestamp": "1465860265",
@@ -232,251 +224,249 @@
   "time": "2016-06-13T23:24:25.466Z"
 }';
 
-			$res = new GSResponse($method, $json, null, 0, null, array());
-
-			$dataArray = $res->getData()->serialize();
-			$profileArray = $dataArray['profile'];
-			$gigyaUser = GigyaUserFactory::createGigyaUserFromArray($dataArray);
-			$gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
-			$gigyaUser->setProfile($gigyaProfile);
-			$this->gigyaUser = $gigyaUser;
-
-			$this->helperMock
-				->expects($this->any())
-				->method('sendApiCall')
-				->will($this->returnCallback(function($method, $params, $access_params) {
-					$aparams = array();
-					$aparams['api_key'] = 'apikey';
-					$aparams['app_secret'] = 'appsecret';
-					$aparams['app_key'] = 'appkey';
-					$aparams['data_center'] = 'us1.gigya.com';
-					if ($access_params !== $aparams)
-					{
-						if ($access_params['api_key'] !== $aparams['api_key'])
-						{
-							$err_number = 400093;
-							$err_message = "Invalid ApiKey parameter";
-						}
-						elseif ($access_params['app_key'] !== $aparams['app_key'])
-						{
-							$err_number = 403005;
-							$err_message = "Unauthorized user";
-						}
-						elseif ($access_params['app_secret'] !== $aparams['app_secret'])
-						{
-							$err_number = 403003;
-							$err_message = "Invalid request signature";
-						}
-						elseif ($access_params['data_center'] !== $aparams['data_center'])
-						{
-							$err_number = 301001;
-							$err_message = "Invalid data center";
-						}
-						else
-						{
-							$err_message = '';
-							$err_number = 0;
-						}
-
-						$res = new GSApiException($err_message, $err_number, $err_message);
-					}
-					elseif ($method == 'shortenURL')
-					{
-						$responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
-						$res = new GSResponse('shortenURL', $responseStr);
-					}
-					else
-						$res = null;
-
-					return $res;
-				}));
-
-			$this->gigyaControl = new GigyaController($this->helperMock);
-		}
-
-		/**
-		 * Tests encrypt.
-		 */
-		public function testEncrypt() {
-//    1. Go to Drupal admin site (not user 1), Gigya settings not with admin user without Gigya Role permission (create new permission group)
-//       Expected: secret key text box is hidden
-
-			$this->drupalGet('admin/config/gigya/keys');
-			$this->assertSession()->statusCodeEquals('403');
-			$this->drupalLogin($this->gigyaAdmin);
-//    2. Give the user permission in Gigya Role and load Gigya settings page
-//       Expected: 1. secret keys is visible.
-
-			$this->drupalGet('admin/config/gigya/keys');
-			$this->assertSession()->statusCodeEquals('200');
-
-			//    $config = Drupal::service('config.factory')->getEditable('gigya.settings')->set('gigya.gigya_application_secret_key', 'a');
-//    $config->save();
-
-//  3. Set Gigya apikey, user app and secret and DC and save settings
-//     Expected: Settings saved secret encrypt on DB and in logs doesn't appear
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = 'apikey';
-			$values['gigya_application_key'] = 'appkey';
-			$values['gigya_application_secret_key'] = 'appsecret';
-			$values['gigya_data_center'] = 'us1.gigya.com';
-			$form_state->setValues($values);
-
-			/** @noinspection PhpMethodParametersCountMismatchInspection */
-			\Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);
-
-			$key = Drupal::service('config.factory')->getEditable('gigya.settings')->get('gigya.gigya_application_secret_key');
-			$this->assertNotEquals($values['gigya_application_secret_key'], $key, 'Key is not encrypted');
-
-			$this->drupalGet('admin/config/gigya/keys');
-			$this->assertSession()->statusCodeEquals('200');
-			$this->assertSession()->elementExists('css', '#edit-gigya-application-secret-key');
-			$this->assertSession()->fieldValueEquals('edit-gigya-application-secret-key', '*********');
-			$this->drupalLogout();
-
-			//@TODO: check logs.
-			//Set other setting and register from front-site without required field - email, enable debug mode
-			//Expected:
-			//1. Error for missing email appears to user
-			//2. Secret doesn't appear in any messages in the logs
-
-			$email = $this->gigyaUser->getProfile()->getEmail();
-			$this->gigyaUser->getProfile()->setEmail("");
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-
-			$response = new AjaxResponse();
-			$err_msg = t('Email address is required by Drupal and is missing, please contact the site administrator.');
-			$response->addCommand(new AlertCommand($err_msg));
-			$this->assertEquals($response->getCommands(), $res->getCommands());
-
-//  Set email with required field and register
-//  Expected:
-//  1.Registration succeed, user appears in Drupal users list
-//  2. Secret doesn't appear in any messages in the logs
-//  3. getAccountInfo fired without any error
-
-			$this->gigyaUser->getProfile()->setEmail($email);
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-			$user = User::load(\Drupal::currentUser()->id());
-			$this->assertTrue(\Drupal::currentUser()->isAuthenticated());
-
-			$this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
-			$this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
-
-			$this->key = 'aa';
-
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalLogout();
-
-			$this->checkBadForm($form_state);
-
-			$err_msg = t("Oops! Something went wrong during your login/registration process. Please try to login/register again.");
-
-			$this->checkBadLogin($err_msg);
-
-			$this->key = $this->trueKey;
-			$this->checkGoodLogin();
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalLogout();
-
-			$this->key = '';
-
-			$this->checkBadForm($form_state);
-			$this->checkBadLogin($err_msg);
-
-			$this->key = $this->trueKey;
-			$this->checkGoodLogin();
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalLogout();
-		}
-
-		/**
-		 * @param FormState $form_state
-		 */
-		public function checkBadForm($form_state) {
-			$form_state->setValue('gigya_application_secret_key', '*********');
-			\Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state);
-//			\Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);
-			$msg = drupal_get_messages();
-			$this->assertArrayHasKey('error', $msg);
-			$this->assertArrayHasKey('0', $msg['error']);
-			$this->assertStringStartsWith('Gigya API error', $msg['error'][0]);
-		}
-
-		public function checkBadLogin($err_msg) {
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-
-			$response = new AjaxResponse();
-			$response->addCommand(new AlertCommand($err_msg));
-			$this->assertEquals($response->getCommands(), $res->getCommands());
-			$this->assertTrue(\Drupal::currentUser()->isAnonymous());
-		}
-
-		public function checkGoodLogin() {
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-			$this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
-			$this->assertTrue(\Drupal::currentUser()->isAuthenticated());
-		}
-
-		public function testUI() {
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalGet('admin/config/gigya/keys');
-			$this->assertSession()->statusCodeEquals('200');
-			$this->assertSession()->elementExists('css', '#edit-gigya-application-secret-key');
-			$this->assertSession()->elementExists('css', '#edit-gigya-api-key');
-			$this->assertSession()->elementExists('css', '#edit-gigya-application-key');
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = ' apikey ';
-			$values['gigya_application_key'] = ' appkey ';
-			$values['gigya_application_secret_key'] = ' appsecret ';
-			$values['gigya_data_center'] = 'us1.gigya.com';
-			$form_state->setValues($values);
-
-			/** @noinspection PhpMethodParametersCountMismatchInspection */
-			\Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);
-			$msg = drupal_get_messages();
-			$this->assertArrayNotHasKey('error', $msg);
-
-			$this->drupalLogout();
-
-			$this->checkGoodLogin();
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = 'apikey';
-			$values['gigya_application_key'] = 'appkey';
-			$values['gigya_application_secret_key'] = 'appsecret';
-			$values['gigya_data_center'] = 'other';
-			$form_state->setValues($values);
-
-			$this->checkBadForm($form_state);
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = 'apikey';
-			$values['gigya_application_key'] = 'appkey';
-			$values['gigya_application_secret_key'] = 'wrong';
-			$values['gigya_data_center'] = 'us1.gigya.com';
-			$form_state->setValues($values);
-
-			$this->checkBadForm($form_state);
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = 'apikey';
-			$values['gigya_application_key'] = 'appkey';
-			$values['gigya_application_secret_key'] = 'wrong';
-			$values['gigya_data_center'] = 'us1.gigya.com';
-			$form_state->setValues($values);
-
-			$this->checkBadForm($form_state);
-
-			$form_state = new FormState();
-			$values['gigya_api_key'] = 'apikey';
-			$values['gigya_application_key'] = 'wrong';
-			$values['gigya_application_secret_key'] = 'appsecret';
-			$values['gigya_data_center'] = 'us1.gigya.com';
-			$form_state->setValues($values);
-
-			$this->checkBadForm($form_state);
-		}
-	}
+    $res = new GSResponse($method, $json, NULL, 0, NULL, []);
+
+    $dataArray = $res->getData()->serialize();
+    $profileArray = $dataArray['profile'];
+    $gigyaUser = GigyaUserFactory::createGigyaUserFromArray($dataArray);
+    $gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
+    $gigyaUser->setProfile($gigyaProfile);
+    $this->gigyaUser = $gigyaUser;
+
+    $this->helperMock
+      ->expects($this->any())
+      ->method('sendApiCall')
+      ->will($this->returnCallback(function ($method, $params, $access_params) {
+         $aparams = [];
+         $aparams['api_key'] = 'apikey';
+         $aparams['app_secret'] = 'appsecret';
+         $aparams['app_key'] = 'appkey';
+         $aparams['data_center'] = 'us1.gigya.com';
+        if ($access_params !== $aparams) {
+          if ($access_params['api_key'] !== $aparams['api_key']) {
+            $err_number = 400093;
+            $err_message = "Invalid ApiKey parameter";
+          }
+          elseif ($access_params['app_key'] !== $aparams['app_key']) {
+            $err_number = 403005;
+            $err_message = "Unauthorized user";
+          }
+          elseif ($access_params['app_secret'] !== $aparams['app_secret']) {
+            $err_number = 403003;
+            $err_message = "Invalid request signature";
+          }
+          elseif ($access_params['data_center'] !== $aparams['data_center']) {
+            $err_number = 301001;
+            $err_message = "Invalid data center";
+          }
+          else {
+            $err_message = '';
+            $err_number = 0;
+          }
+
+          $res = new GSApiException($err_message, $err_number, $err_message);
+        }
+        elseif ($method == 'shortenURL') {
+          $responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
+          $res = new GSResponse('shortenURL', $responseStr);
+        }
+        else {
+          $res = NULL;
+        }
+
+         return $res;
+      }));
+
+    $this->gigyaControl = new GigyaController($this->helperMock);
+  }
+
+  /**
+   * Tests encrypt.
+   */
+  public function testEncrypt() {
+    // 1. Go to Drupal admin site (not user 1), Gigya settings not with admin user without Gigya Role permission (create new permission group)
+    //    Expected: secret key text box is hidden.
+    $this->drupalGet('admin/config/gigya/keys');
+    $this->assertSession()->statusCodeEquals('403');
+    $this->drupalLogin($this->gigyaAdmin);
+    // 2. Give the user permission in Gigya Role and load Gigya settings page
+    //    Expected: 1. secret keys is visible.
+    $this->drupalGet('admin/config/gigya/keys');
+    $this->assertSession()->statusCodeEquals('200');
+
+    // $config = Drupal::service('config.factory')->getEditable('gigya.settings')->set('gigya.gigya_application_secret_key', 'a');
+    //    $config->save();
+    //  3. Set Gigya apikey, user app and secret and DC and save settings
+    //     Expected: Settings saved secret encrypt on DB and in logs doesn't appear.
+    $form_state = new FormState();
+    $values['gigya_api_key'] = 'apikey';
+    $values['gigya_application_key'] = 'appkey';
+    $values['gigya_application_secret_key'] = 'appsecret';
+    $values['gigya_data_center'] = 'us1.gigya.com';
+    $form_state->setValues($values);
+
+    /** @noinspection PhpMethodParametersCountMismatchInspection */
+    \Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);
+
+    $key = Drupal::service('config.factory')->getEditable('gigya.settings')->get('gigya.gigya_application_secret_key');
+    $this->assertNotEquals($values['gigya_application_secret_key'], $key, 'Key is not encrypted');
+
+    $this->drupalGet('admin/config/gigya/keys');
+    $this->assertSession()->statusCodeEquals('200');
+    $this->assertSession()->elementExists('css', '#edit-gigya-application-secret-key');
+    $this->assertSession()->fieldValueEquals('edit-gigya-application-secret-key', '*********');
+    $this->drupalLogout();
+
+    // @TODO: check logs.
+    // Set other setting and register from front-site without required field - email, enable debug mode
+    // Expected:
+    // 1. Error for missing email appears to user
+    // 2. Secret doesn't appear in any messages in the logs
+    $email = $this->gigyaUser->getProfile()->getEmail();
+    $this->gigyaUser->getProfile()->setEmail("");
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+
+    $response = new AjaxResponse();
+    $err_msg = t('Email address is required by Drupal and is missing, please contact the site administrator.');
+    $response->addCommand(new AlertCommand($err_msg));
+    $this->assertEquals($response->getCommands(), $res->getCommands());
+
+    // Set email with required field and register
+    //  Expected:
+    //  1.Registration succeed, user appears in Drupal users list
+    //  2. Secret doesn't appear in any messages in the logs
+    //  3. getAccountInfo fired without any error.
+    $this->gigyaUser->getProfile()->setEmail($email);
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+    $user = User::load(\Drupal::currentUser()->id());
+    $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
+
+    $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
+    $this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
+
+    $this->key = 'aa';
+
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalLogout();
+
+    $this->checkBadForm($form_state);
+
+    $err_msg = t("Oops! Something went wrong during your login/registration process. Please try to login/register again.");
+
+    $this->checkBadLogin($err_msg);
+
+    $this->key = $this->trueKey;
+    $this->checkGoodLogin();
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalLogout();
+
+    $this->key = '';
+
+    $this->checkBadForm($form_state);
+    $this->checkBadLogin($err_msg);
+
+    $this->key = $this->trueKey;
+    $this->checkGoodLogin();
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalLogout();
+  }
+
+  /**
+   * @param \Drupal\Core\Form\FormState $form_state
+   */
+  public function checkBadForm($form_state) {
+    $form_state->setValue('gigya_application_secret_key', '*********');
+    \Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state);
+    // \Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);.
+    $msg = drupal_get_messages();
+    $this->assertArrayHasKey('error', $msg);
+    $this->assertArrayHasKey('0', $msg['error']);
+    $this->assertStringStartsWith('Gigya API error', $msg['error'][0]);
+  }
+
+  /**
+   *
+   */
+  public function checkBadLogin($err_msg) {
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+
+    $response = new AjaxResponse();
+    $response->addCommand(new AlertCommand($err_msg));
+    $this->assertEquals($response->getCommands(), $res->getCommands());
+    $this->assertTrue(\Drupal::currentUser()->isAnonymous());
+  }
+
+  /**
+   *
+   */
+  public function checkGoodLogin() {
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+    $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
+    $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
+  }
+
+  /**
+   *
+   */
+  public function testUI() {
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalGet('admin/config/gigya/keys');
+    $this->assertSession()->statusCodeEquals('200');
+    $this->assertSession()->elementExists('css', '#edit-gigya-application-secret-key');
+    $this->assertSession()->elementExists('css', '#edit-gigya-api-key');
+    $this->assertSession()->elementExists('css', '#edit-gigya-application-key');
+
+    $form_state = new FormState();
+    $values['gigya_api_key'] = ' apikey ';
+    $values['gigya_application_key'] = ' appkey ';
+    $values['gigya_application_secret_key'] = ' appsecret ';
+    $values['gigya_data_center'] = 'us1.gigya.com';
+    $form_state->setValues($values);
+
+    /** @noinspection PhpMethodParametersCountMismatchInspection */
+    \Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaKeysForm', $form_state, $this->helperMock);
+    $msg = drupal_get_messages();
+    $this->assertArrayNotHasKey('error', $msg);
+
+    $this->drupalLogout();
+
+    $this->checkGoodLogin();
+
+    $form_state = new FormState();
+    $values['gigya_api_key'] = 'apikey';
+    $values['gigya_application_key'] = 'appkey';
+    $values['gigya_application_secret_key'] = 'appsecret';
+    $values['gigya_data_center'] = 'other';
+    $form_state->setValues($values);
+
+    $this->checkBadForm($form_state);
+
+    $form_state = new FormState();
+    $values['gigya_api_key'] = 'apikey';
+    $values['gigya_application_key'] = 'appkey';
+    $values['gigya_application_secret_key'] = 'wrong';
+    $values['gigya_data_center'] = 'us1.gigya.com';
+    $form_state->setValues($values);
+
+    $this->checkBadForm($form_state);
+
+    $form_state = new FormState();
+    $values['gigya_api_key'] = 'apikey';
+    $values['gigya_application_key'] = 'appkey';
+    $values['gigya_application_secret_key'] = 'wrong';
+    $values['gigya_data_center'] = 'us1.gigya.com';
+    $form_state->setValues($values);
+
+    $this->checkBadForm($form_state);
+
+    $form_state = new FormState();
+    $values['gigya_api_key'] = 'apikey';
+    $values['gigya_application_key'] = 'wrong';
+    $values['gigya_application_secret_key'] = 'appsecret';
+    $values['gigya_data_center'] = 'us1.gigya.com';
+    $form_state->setValues($values);
+
+    $this->checkBadForm($form_state);
+  }
+
+}
diff --git a/gigya_ds/gigya_ds.api.php b/gigya_ds/gigya_ds.api.php
index 3e11326..67dcc10 100755
--- a/gigya_ds/gigya_ds.api.php
+++ b/gigya_ds/gigya_ds.api.php
@@ -1,15 +1,15 @@
 <?php
+
 /**
+ * @file
  * Created by PhpStorm.
  * User: Yaniv Aran-Shamir
  * Date: 10/23/16
- * Time: 9:18 AM
+ * Time: 9:18 AM.
  */
 
 /**
- *
  * This is an example of how to fetch ds data only for the current user uid.
- *
  */
 function fetch_ds_data_only() {
   global $user;
@@ -22,8 +22,9 @@ function fetch_ds_data_only() {
 
 /**
  * The following example add a value to the ds data array.
+ *
  * @param $ds_data
  */
 function hook_gigya_ds_data_alter(&$ds_data) {
-//  $ds_data['type']['field'] = "d";
+  // $ds_data['type']['field'] = "d";.
 }
diff --git a/gigya_ds/gigya_ds.module b/gigya_ds/gigya_ds.module
index 672c5ae..795520d 100755
--- a/gigya_ds/gigya_ds.module
+++ b/gigya_ds/gigya_ds.module
@@ -1,5 +1,11 @@
 <?php
+
+/**
+ * @file
+ */
+
 use Drupal\gigya\Helper\GigyaHelper;
+
 /**
  * @file
  * This module provides a link to Gigya DS data.
@@ -30,6 +36,9 @@ function gigya_ds_gigya_raas_map_data_alter(&$gigya_data, &$drupal_user, &$field
   $gigya_data->ds = $res;
 }
 
+/**
+ *
+ */
 function gigya_ds_get_data($uid) {
   $mapping = gigya_ds_retrieve_field_mappings();
   if (!$mapping) {
@@ -42,11 +51,12 @@ function gigya_ds_get_data($uid) {
   \Drupal::moduleHandler()->alter('gigya_ds_data', $res);
   return $res;
 
-
 }
 
-
-function _gigya_ds_map_data(&$user_array ,$uid) {
+/**
+ *
+ */
+function _gigya_ds_map_data(&$user_array, $uid) {
 
   $mapping = gigya_ds_retrieve_field_mappings();
   if (!$mapping) {
@@ -56,7 +66,7 @@ function _gigya_ds_map_data(&$user_array ,$uid) {
   $fields_map = _gigya_ds_get_map_keys($mapping);
   $res = _gigya_ds_create_query($fields_map, $uid);
 
-  $drupal_map = array();
+  $drupal_map = [];
   foreach ($mapping as $map) {
     if ($map['cmsType'] == 'string') {
       $drupal_map[$map['gigyaName']] = $map['cmsName'] . "::255";
@@ -66,24 +76,29 @@ function _gigya_ds_map_data(&$user_array ,$uid) {
     }
   }
   if ($res) {
-    _process_field_map($drupal_map, array('ds' => $res), $user_array);
+    _process_field_map($drupal_map, ['ds' => $res], $user_array);
   }
 }
 
+/**
+ *
+ */
 function _gigya_ds_get_map_keys($array) {
-  $cmsKeyedArray = array();
-  $gigyaKeyedArray = array();
+  $cmsKeyedArray = [];
+  $gigyaKeyedArray = [];
   foreach ($array as $confItem) {
     $cmsKey = $confItem['cmsName'];
     $gigyaKey = $confItem['gigyaName'];
     $direction = empty($confItem['direction']) ? "g2cms" : $confItem['direction'];
     switch ($direction) {
-      case "g2cms" :
+      case "g2cms":
         $gigyaKeyedArray[$gigyaKey][] = $confItem;
         break;
+
       case "cms2g":
         $cmsKeyedArray[$cmsKey][] = $confItem;
         break;
+
       default:
         $gigyaKeyedArray[$gigyaKey][] = $confItem;
         $cmsKeyedArray[$cmsKey][] = $confItem;
@@ -93,34 +108,44 @@ function _gigya_ds_get_map_keys($array) {
   return $gigyaKeyedArray;
 }
 
-
+/**
+ *
+ */
 function gigya_ds_retrieve_field_mappings() {
   try {
     $mappingJson = \Drupal::config('gigya_ds.settings')->get('gigya_ds.gigya_ds_mapping');
     if ('' == $mappingJson) {
-        \Drupal::logger('gigya_ds')->error('No mapping found');
+      \Drupal::logger('gigya_ds')->error('No mapping found');
       return FALSE;
     }
     return (_gigya_ds_process_mapping($mappingJson));
-  } catch (Exception $e) {
-      \Drupal::logger('gigya_ds')->error('No mapping file found');
+  }
+  catch (Exception $e) {
+    \Drupal::logger('gigya_ds')->error('No mapping file found');
     return FALSE;
   }
 }
 
+/**
+ *
+ */
 function _gigya_ds_process_mapping($json) {
   try {
     $map = json_decode($json, TRUE);
 
     return $map;
-  } catch (Exception $e) {
+  }
+  catch (Exception $e) {
     return FALSE;
   }
 }
 
+/**
+ *
+ */
 function _gigya_ds_create_query($gigya_keyed, $uid) {
 
-  $types = array();
+  $types = [];
   foreach ($gigya_keyed as $key => $value) {
     if (strpos($key, 'ds.') === 0) {
       $keyArray = explode('.', $key, 3);
@@ -146,14 +171,18 @@ function _gigya_ds_create_query($gigya_keyed, $uid) {
   return $res;
 }
 
+/**
+ *
+ */
 function _gigya_ds_do_ds_get($types, $fields, $uid) {
   $helper = new GigyaHelper();
-  $data = array();
+  $data = [];
   foreach ($types as $type => $oids) {
     foreach ($oids as $oid) {
       if (!isset($data[$type])) {
         $data[$type] = $helper->doSingleDsGet($type, $oid, $fields, $uid);
-      } else {
+      }
+      else {
         $data[$type] += $helper->doSingleDsGet($type, $oid, $fields, $uid);
       }
     }
@@ -161,10 +190,12 @@ function _gigya_ds_do_ds_get($types, $fields, $uid) {
   return $data;
 }
 
-
+/**
+ *
+ */
 function _gigya_ds_do_ds_search($types, $fields, $uid) {
   $helper = new GigyaHelper();
-  $data = array();
+  $data = [];
   foreach ($types as $type => $oid) {
     foreach ($oid as $oid_value) {
       if (!isset($data[$type])) {
@@ -178,8 +209,11 @@ function _gigya_ds_do_ds_search($types, $fields, $uid) {
   return $data;
 }
 
+/**
+ *
+ */
 function _gigya_ds_extract_oids($confs) {
-  $oids = array();
+  $oids = [];
   foreach ($confs as $conf) {
     $customConf = $conf['custom'];
     /** @var string $oid */
diff --git a/gigya_ds/tests/src/GigyaDsTests.php b/gigya_ds/tests/src/GigyaDsTests.php
index 31d44e4..7e0938f 100755
--- a/gigya_ds/tests/src/GigyaDsTests.php
+++ b/gigya_ds/tests/src/GigyaDsTests.php
@@ -1,24 +1,11 @@
 <?php
-/**
- * Created by PhpStorm.
- * User: Inbal.Zi
- * Date: 11/19/2017
- * Time: 2:41 PM
- *
- *  @file
- * Contains \Drupal\Tests\gigya_ds\src\GigyaDsTests.
- */
-
 
 namespace Drupal\modules\gigya\gigya_ds\tests;
 
-use Drupal;
+use Drupal\user\Entity\User;
 use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\AlertCommand;
 use Drupal\Core\Ajax\RedirectCommand;
-use Drupal\gigya\Helper;
 use Drupal\gigya_raas\GigyaController;
-use Drupal\gigya\Helper\GigyaHelper;
 use Drupal\Tests\BrowserTestBase;
 use Gigya\CmsStarterKit\sdk\GSApiException;
 use Gigya\CmsStarterKit\sdk\GSResponse;
@@ -29,69 +16,62 @@ use Gigya\CmsStarterKit\user\GigyaUserFactory;
  *
  * @group gigya
  */
-class GigyaTest extends BrowserTestBase
-{
-
-    private $gigyaControl = "";
-
-    private $requestMock = "";
-
-    private $successResponse = "";
-
-
-
-    /**
-     * Modules to enable.
-     *
-     * @var array
-     */
-    public static $modules = array('gigya', 'gigya_raas', 'gigya_ds');
+class GigyaTest extends BrowserTestBase {
 
-    /**
-     * The user for tests.
-     *
-     * @var \Drupal\user\UserInterface
-     */
-    protected $webUser;
+  private $gigyaControl = "";
 
-    /**
-     * The user for tests.
-     *
-     * @var \Drupal\user\UserInterface
-     */
-    protected $gigyaAdmin;
-    protected $gigyaHelper;
+  private $requestMock = "";
 
+  private $successResponse = "";
 
-    protected $helperMock;
 
-    protected $gigyaUser;
 
-    /**
-     * {@inheritdoc}
-     */
-    public function setUp(){
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['gigya', 'gigya_raas', 'gigya_ds'];
 
-        parent::setUp();
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $webUser;
 
-        $this->successResponse = new AjaxResponse();
-        $this->successResponse->addCommand(new RedirectCommand("/"));
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $gigyaAdmin;
+  protected $gigyaHelper;
 
 
+  protected $helperMock;
 
-        $this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+  protected $gigyaUser;
 
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
 
+    parent::setUp();
 
-        $this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
-        $this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
-            ->setMethods(array('getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'))
-            ->getMock();
+    $this->successResponse = new AjaxResponse();
+    $this->successResponse->addCommand(new RedirectCommand("/"));
 
+    $this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
 
+    $this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
+    $this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
+      ->setMethods(['getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'])
+      ->getMock();
 
-        $method = "accounts.getAccountInfo";
-        $json = '{
+    $method = "accounts.getAccountInfo";
+    $json = '{
   "UID": "_guid_-SPzNo7usObOUAUKT0KC-yijanD1CTN4n-syLkRjj5k=",
   "UIDSignature": "cTXiwusSZP3b/VpAZ9ik2PDvAI0=",
   "signatureTimestamp": "1465860265",
@@ -222,70 +202,68 @@ class GigyaTest extends BrowserTestBase
   "time": "2016-06-13T23:24:25.466Z"
 }';
 
-        $res = new GSResponse($method, $json, null, 0, null, array());
+    $res = new GSResponse($method, $json, NULL, 0, NULL, []);
 
-        $dataArray = $res->getData()->serialize();
-        $profileArray = $dataArray['profile'];
-        $gigyaUser    = GigyaUserFactory::createGigyaUserFromArray($dataArray);
-        $gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
-        $gigyaUser->setProfile($gigyaProfile);
-        $this->gigyaUser = $gigyaUser;
+    $dataArray    = $res->getData()->serialize();
+    $profileArray = $dataArray['profile'];
+    $gigyaUser    = GigyaUserFactory::createGigyaUserFromArray($dataArray);
+    $gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
+    $gigyaUser->setProfile($gigyaProfile);
+    $this->gigyaUser = $gigyaUser;
 
-
-
-        $this->helperMock
-            ->expects($this->any())
-            ->method('sendApiCall')
-            ->will($this->returnCallback(function($method, $params, $access_params) {
-                $aparams = array();
+    $this->helperMock
+      ->expects($this->any())
+      ->method('sendApiCall')
+      ->will($this->returnCallback(function ($method, $params, $access_params) {
+                $aparams = [];
                 $aparams['api_key'] = 'apikey';
                 $aparams['session_time'] = 'appsecret';
                 $aparams['app_key'] = 'appkey';
                 $aparams['data_center'] = 'us1.gigya.com';
-                if ($access_params !== $aparams) {
-                    if ($access_params['api_key'] !== $aparams['api_key']) {
-                        $err_number = 400093;
-                        $err_message = "Invalid ApiKey parameter";
-                    }
-                    else if ($access_params['app_key'] !== $aparams['app_key']) {
-                        $err_number = 403005;
-                        $err_message = "Unauthorized user";
-                    }
-                    else if ($access_params['app_secret'] !== $aparams['app_secret']) {
-                        $err_number = 403003;
-                        $err_message = "Invalid request signature";
-                    }
-                    else if ($access_params['data_center'] !== $aparams['data_center']) {
-                        $err_number = 301001;
-                        $err_message = "Invalid data center";
-                    }
-
-                    $res = new GSApiException($err_message, $err_number, $err_message);
-                }
-                else if($method == 'shortenURL') {
-                    $responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
-                    $res = new GSResponse('shortenURL', $responseStr);
-
-                }
+        if ($access_params !== $aparams) {
+          if ($access_params['api_key'] !== $aparams['api_key']) {
+            $err_number = 400093;
+            $err_message = "Invalid ApiKey parameter";
+          }
+          elseif ($access_params['app_key'] !== $aparams['app_key']) {
+              $err_number = 403005;
+              $err_message = "Unauthorized user";
+          }
+          elseif ($access_params['app_secret'] !== $aparams['app_secret']) {
+              $err_number = 403003;
+              $err_message = "Invalid request signature";
+          }
+          elseif ($access_params['data_center'] !== $aparams['data_center']) {
+              $err_number = 301001;
+              $err_message = "Invalid data center";
+          }
+
+          $res = new GSApiException($err_message, $err_number, $err_message);
+        }
+        elseif ($method == 'shortenURL') {
+            $responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
+            $res = new GSResponse('shortenURL', $responseStr);
+
+        }
 
                 return $res;
-            }));
-
-        $this->gigyaControl = new GigyaController($this->helperMock);
-    }
-
-    /**
-     * Tests ds.search simple
-     */
-    public function testDsSearch_simple()
-    {
-        $email = $this->gigyaUser->getProfile()->getEmail();
-        $this->gigyaUser->getProfile()->setEmail($email);
-        $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-        $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
-        $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
-
-        $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
-        $this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
-    }
-}
\ No newline at end of file
+      }));
+
+    $this->gigyaControl = new GigyaController($this->helperMock);
+  }
+
+  /**
+   * Tests ds.search simple.
+   */
+  public function testDsSearch_simple() {
+    $email = $this->gigyaUser->getProfile()->getEmail();
+    $this->gigyaUser->getProfile()->setEmail($email);
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+    $user = User::load(\Drupal::currentUser()->id());
+    $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
+
+    $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
+    $this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
+  }
+
+}
diff --git a/gigya_raas/gigya_raas.api.php b/gigya_raas/gigya_raas.api.php
index fb3806e..0beec55 100755
--- a/gigya_raas/gigya_raas.api.php
+++ b/gigya_raas/gigya_raas.api.php
@@ -35,4 +35,4 @@ function hook_gigya_raas_profile_settings_alter(array &$raas_profile) {
 
 /**
  * @} End of "addtogroup hooks".
- */
\ No newline at end of file
+ */
diff --git a/gigya_raas/gigya_raas.install b/gigya_raas/gigya_raas.install
index d72b760..9b2bf87 100755
--- a/gigya_raas/gigya_raas.install
+++ b/gigya_raas/gigya_raas.install
@@ -5,8 +5,6 @@
  * Installation functions for Gigya module.
  */
 
-use Drupal\User\RoleInterface;
-
 /**
  * Implements hook_install.
  */
@@ -14,6 +12,9 @@ function gigya_raas_install() {
 
 }
 
+/**
+ *
+ */
 function gigya_raas_uninstall() {
 
-}
\ No newline at end of file
+}
diff --git a/gigya_raas/gigya_raas.module b/gigya_raas/gigya_raas.module
index b60106b..c29376d 100755
--- a/gigya_raas/gigya_raas.module
+++ b/gigya_raas/gigya_raas.module
@@ -1,4 +1,9 @@
 <?php
+
+/**
+ * @file
+ */
+
 use Drupal\gigya\Helper\GigyaHelper;
 
 /**
@@ -18,45 +23,44 @@ function gigya_raas_page_attachments(array &$attachments) {
       $attachments['#attached']['drupalSettings']['gigyaExtra']['isLogin'] = \Drupal::currentUser()->isAuthenticated();
 
       $session_type = \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_type');
-      $attachments['#attached']['drupalSettings']['gigyaExtra']['session_type'] =  $session_type;
+      $attachments['#attached']['drupalSettings']['gigyaExtra']['session_type'] = $session_type;
 
       $session_time = \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_time');
-      $attachments['#attached']['drupalSettings']['gigyaExtra']['session_time'] =  $session_time;
+      $attachments['#attached']['drupalSettings']['gigyaExtra']['session_time'] = $session_time;
 
-      //get sessionExpiration from Raas settings and set globalParameters with the value
+      // Get sessionExpiration from Raas settings and set globalParameters with the value.
       $expiration = $session_type == "dynamic" ? -1 : $session_time;
 
       $global_params = \Drupal::config('gigya.global')->get('gigya.globalParameters');
       $global_params['sessionExpiration'] = $expiration;
       $attachments['#attached']['drupalSettings']['gigya']['globalParameters'] = $global_params;
 
-
       if (\Drupal::currentUser()->isAnonymous()) {
-        $raas_login    = array(
+        $raas_login    = [
           'screenSet'       => 'Default-RegistrationLogin',
           'mobileScreenSet' => '',
           'startScreen'     => 'gigya-login-screen',
-          'sessionExpiration' => $expiration
-        );
-        $raas_register = array(
+          'sessionExpiration' => $expiration,
+        ];
+        $raas_register = [
           'screenSet'       => 'Default-RegistrationLogin',
           'mobileScreenSet' => '',
           'startScreen'     => 'gigya-register-screen',
-          'sessionExpiration' => $expiration
-        );
+          'sessionExpiration' => $expiration,
+        ];
         \Drupal::moduleHandler()->alter('gigya_raas_settings', $raas_login, $raas_register);
         $attachments['#attached']['drupalSettings']['gigya']['raas']['login']    = $raas_login;
         $attachments['#attached']['drupalSettings']['gigya']['raas']['register'] = $raas_register;
-        $attachments['#attached']['drupalSettings']['gigyaExtra']['isLogin'] = FALSE;
+        $attachments['#attached']['drupalSettings']['gigyaExtra']['isLogin']     = FALSE;
       }
       else {
         $attachments['#attached']['drupalSettings']['gigyaExtra']['bypassRaas'] = Drupal::currentUser()->hasPermission(
           'bypass gigya raas'
         );
-        $raas_profile = array(
+        $raas_profile = [
           'screenSet'       => 'Default-ProfileUpdate',
-          'mobileScreenSet' => 'DefaultMobile-ProfileUpdate'
-        );
+          'mobileScreenSet' => 'DefaultMobile-ProfileUpdate',
+        ];
         \Drupal::moduleHandler()->alter('gigya_raas_profile_settings', $raas_profile);
         $attachments['#attached']['drupalSettings']['gigya']['raas']['profile'] = $raas_profile;
       }
@@ -69,20 +73,20 @@ function gigya_raas_page_attachments(array &$attachments) {
  * Implements hook_theme().
  */
 function gigya_raas_theme($existing, $type, $theme, $path) {
-  return array(
-    'gigya_raas_links_block'    => array(
-      'variables' => array('links' => NULL, 'title' => NULL),
-    ),
-    'gigya_raas_login_block'    => array(
-      'variables' => array('showDiv' => NULL),
-    ),
-    'gigya_raas_register_block' => array(
-      'variables' => array('showDiv' => NULL),
-    ),
-    'gigya_raas_profile_block'  => array(
-      'variables' => array('showDiv' => NULL),
-    )
-  );
+  return [
+    'gigya_raas_links_block'    => [
+      'variables' => ['links' => NULL, 'title' => NULL],
+    ],
+    'gigya_raas_login_block'    => [
+      'variables' => ['showDiv' => NULL],
+    ],
+    'gigya_raas_register_block' => [
+      'variables' => ['showDiv' => NULL],
+    ],
+    'gigya_raas_profile_block'  => [
+      'variables' => ['showDiv' => NULL],
+    ],
+  ];
 }
 
 /**
@@ -101,7 +105,10 @@ function gigya_raas_user_login($account) {
   }
 }
 
+/**
+ *
+ */
 function gigya_raas_user_logout($account) {
   $helper = new GigyaHelper();
   $helper->saveUserLogoutCookie();
-}
\ No newline at end of file
+}
diff --git a/gigya_raas/src/Form/GigyaSessionForm.php b/gigya_raas/src/Form/GigyaSessionForm.php
index 1a244bc..6314435 100755
--- a/gigya_raas/src/Form/GigyaSessionForm.php
+++ b/gigya_raas/src/Form/GigyaSessionForm.php
@@ -1,82 +1,83 @@
 <?php
-/**
- * Created by PhpStorm.
- * User: Yaniv Aran-Shamir
- * Date: 5/23/17
- * Time: 9:19 AM
- */
 
 namespace Drupal\gigya_raas\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 
-class GigyaSessionForm extends ConfigFormBase
-{
-	/**
-	 * @param $form_state
-	 * @param $prop_name
-	 * @return string
-	 */
-	private function getValue($form_state, $prop_name) {
-		return trim($form_state->getValue($prop_name));
-	}
+/**
+ *
+ */
+class GigyaSessionForm extends ConfigFormBase {
+
+  /**
+   * @param $form_state
+   * @param $prop_name
+   * @return string
+   */
+  private function getValue($form_state, $prop_name) {
+    return trim($form_state->getValue($prop_name));
+  }
+
+  /**
+   * Gets the configuration names that will be editable.
+   *
+   * @return array
+   *   An array of configuration object names that are editable if called in
+   *   conjunction with the trait's config() method.
+   */
+  protected function getEditableConfigNames() {
+    return [
+      'gigya_raas.settings',
+    ];
+  }
 
-	/**
-	 * Gets the configuration names that will be editable.
-	 *
-	 * @return array
-	 *   An array of configuration object names that are editable if called in
-	 *   conjunction with the trait's config() method.
-	 */
-	protected function getEditableConfigNames() {
-		return [
-			'gigya_raas.settings',
-		];
-	}
+  /**
+   * Returns a unique string identifying the form.
+   *
+   * @return string
+   *   The unique string identifying the form.
+   */
+  public function getFormId() {
+    return 'gigya_raas_session';
+  }
 
-	/**
-	 * Returns a unique string identifying the form.
-	 *
-	 * @return string
-	 *   The unique string identifying the form.
-	 */
-	public function getFormId() {
-		return 'gigya_raas_session';
-	}
+  /**
+   * @param array $form
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *
+   * @return    array
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $form = parent::buildForm($form, $form_state);
+    $config = $this->config('gigya_raas.settings');
+    $form['session_type'] = [
+      '#type'          => 'radios',
+      '#title'         => $this->t('Session Type'),
+      '#description'   => $this->t('If you choose “Fixed”, the user session lasts for the duration specified below. If you choose “Dynamic”, the user session lasts the specified duration, and restarts with every server-side interaction.'),
+      '#options'       => ['fixed' => $this->t('Fixed'), 'dynamic' => $this->t('Dynamic')],
+      '#default_value' => $config->get('gigya_raas.session_type'),
+    ];
+    $form['session_time'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Session Duration (in seconds)'),
+      '#description'   => $this->t('The session is led by Gigya. For more information visit <a href="@Gigya documentation"><u>Gigya\'s documentation</u></a>.', ['@Gigya documentation' => 'https://developers.gigya.com/display/GD/GConnector+-+CMS+and+E-Commerce+Integrations']),
+      '#default_value' => $config->get('gigya_raas.session_time'),
+    ];
 
-	/**
-	 * @param array $form
-	 * @param \Drupal\Core\Form\FormStateInterface $form_state
-	 *
-	 * @return    array
-	 */
-	public function buildForm(array $form, FormStateInterface $form_state) {
-		$form = parent::buildForm($form, $form_state);
-		$config = $this->config('gigya_raas.settings');
-		$form['session_type'] = array(
-			'#type'          => 'radios',
-			'#title'         => $this->t('Session Type'),
-			'#description'   => $this->t('If you choose “Fixed”, the user session lasts for the duration specified below. If you choose “Dynamic”, the user session lasts the specified duration, and restarts with every server-side interaction.'),
-			'#options'       => array('fixed' => $this->t('Fixed'), 'dynamic' => $this->t('Dynamic')),
-			'#default_value' => $config->get('gigya_raas.session_type'),
-		);
-		$form['session_time'] = array(
-			'#type'          => 'textfield',
-			'#title'         => $this->t('Session Duration (in seconds)'),
-			'#description'   => $this->t('The session is led by Gigya. For more information visit <a href="@Gigya documentation"><u>Gigya\'s documentation</u></a>.', array('@Gigya documentation' => 'https://developers.gigya.com/display/GD/GConnector+-+CMS+and+E-Commerce+Integrations')),
-			'#default_value' => $config->get('gigya_raas.session_time'),
-		);
+    return $form;
+  }
 
-		return $form;
-	}
+  /**
+   *
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $config = $this->config('gigya_raas.settings');
+    $config->set('gigya_raas.session_type', $this->getValue($form_state, 'session_type'));
+    $config->set('gigya_raas.session_time', $this->getValue($form_state, 'session_time'));
+    $config->save();
 
-	public function submitForm(array &$form, FormStateInterface $form_state) {
-		$config = $this->config('gigya_raas.settings');
-		$config->set('gigya_raas.session_type', $this->getValue($form_state, 'session_type'));
-		$config->set('gigya_raas.session_time', $this->getValue($form_state, 'session_time'));
-		$config->save();
+    parent::submitForm($form, $form_state);
+  }
 
-		parent::submitForm($form, $form_state);
-	}
-}
\ No newline at end of file
+}
diff --git a/gigya_raas/src/GigyaController.php b/gigya_raas/src/GigyaController.php
index 1e28150..e91c5c3 100755
--- a/gigya_raas/src/GigyaController.php
+++ b/gigya_raas/src/GigyaController.php
@@ -1,328 +1,296 @@
 <?php
-	/**
-	 * @file
-	 * Contains \Drupal\gigya\GigyaController.
-	 */
 
-	namespace Drupal\gigya_raas;
+namespace Drupal\gigya_raas;
 
-	use Drupal\Core\Ajax\AjaxResponse;
-	use Drupal\Core\Ajax\AlertCommand;
-	use Drupal\Core\Ajax\InvokeCommand;
-	use Drupal\Core\Controller\ControllerBase;
-	use Drupal\user\Entity\User;
-	use Drupal\user\UserInterface;
-	use Symfony\Component\HttpFoundation\Request;
-	use Drupal\gigya\Helper\GigyaHelper;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\AlertCommand;
+use Drupal\Core\Ajax\InvokeCommand;
+use Drupal\Core\Controller\ControllerBase;
+use Drupal\user\Entity\User;
+use Symfony\Component\HttpFoundation\Request;
+use Drupal\gigya\Helper\GigyaHelper;
 
-	/**
-	 * Returns responses for Editor module routes.
-	 */
-	class GigyaController extends ControllerBase
-	{
-		/** @var GigyaHelper */
-		protected $helper;
+/**
+ * Returns responses for Editor module routes.
+ */
+class GigyaController extends ControllerBase {
+  /**
+   * @var \Drupal\gigya\Helper\GigyaHelper*/
+  protected $helper;
 
-		/**
-		 * Construct method.
-		 *
-		 * @param bool $helper
-		 */
-		public function __construct($helper = FALSE) {
-			if ($helper == FALSE)
-			{
-				$this->helper = new GigyaHelper();
-			}
-			else
-			{
-				$this->helper = $helper;
-			}
-		}
+  /**
+   * Construct method.
+   *
+   * @param bool $helper
+   */
+  public function __construct($helper = FALSE) {
+    if ($helper == FALSE) {
+      $this->helper = new GigyaHelper();
+    }
+    else {
+      $this->helper = $helper;
+    }
+  }
 
-		/**
-		 * Process Gigya RaaS login.
-		 *
-		 * @param \Symfony\Component\HttpFoundation\Request $request
-		 *   The incoming request object.
-		 *
-		 * @return \Drupal\Core\Ajax\AjaxResponse
-		 *   The Ajax response
-		 *
-		 * @throws \Drupal\Core\Entity\EntityStorageException
-		 */
-		public function gigyaRaasProfileAjax(Request $request) {
-			$gigya_data = $request->get('gigyaData');
-			if ($gigyaUser = $this->helper->validateUid($gigya_data['UID'], $gigya_data['UIDSignature'], $gigya_data['signatureTimestamp']))
-			{
-				if ($user = $this->helper->getUidByUUID($gigyaUser->getUID()))
-				{
-					if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, $user->id()))
-					{
-						if ($user->mail !== $unique_email)
-						{
-							$user->setEmail($unique_email);
-							$user->save();
-						}
-					}
-					$this->helper->processFieldMapping($gigyaUser, $user);
-					\Drupal::moduleHandler()->alter('gigya_profile_update', $gigyaUser, $user);
-					$user->save();
-				}
-			}
-			return new AjaxResponse();
-		}
+  /**
+   * Process Gigya RaaS login.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The incoming request object.
+   *
+   * @return \Drupal\Core\Ajax\AjaxResponse
+   *   The Ajax response
+   *
+   * @throws \Drupal\Core\Entity\EntityStorageException
+   */
+  public function gigyaRaasProfileAjax(Request $request) {
+    $gigya_data = $request->get('gigyaData');
+    if ($gigyaUser = $this->helper->validateUid($gigya_data['UID'], $gigya_data['UIDSignature'], $gigya_data['signatureTimestamp'])) {
+      if ($user = $this->helper->getUidByUUID($gigyaUser->getUID())) {
+        if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, $user->id())) {
+          if ($user->mail !== $unique_email) {
+            $user->setEmail($unique_email);
+            $user->save();
+          }
+        }
+        $this->helper->processFieldMapping($gigyaUser, $user);
+        \Drupal::moduleHandler()->alter('gigya_profile_update', $gigyaUser, $user);
+        $user->save();
+      }
+    }
+    return new AjaxResponse();
+  }
 
-		/**
-		 * @param Request $request      The incoming request object.
-		 *
-		 * @return bool|AjaxResponse    The Ajax response
-		 *
-		 * @throws \Drupal\Core\Entity\EntityStorageException
-		 */
-		public function gigyaRaasLoginAjax(Request $request) {
-			if (\Drupal::currentUser()->isAnonymous())
-			{
-				global $raas_login;
-				$err_msg = FALSE;
-				$sig_timestamp = $request->get('sig_timestamp');
-				$guid = $request->get('uid');
-				$uid_sig = $request->get('uid_sig');
+  /**
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The incoming request object.
+   *
+   * @return bool|AjaxResponse    The Ajax response
+   *
+   * @throws \Drupal\Core\Entity\EntityStorageException
+   */
+  public function gigyaRaasLoginAjax(Request $request) {
+    if (\Drupal::currentUser()->isAnonymous()) {
+      global $raas_login;
+      $err_msg = FALSE;
+      $sig_timestamp = $request->get('sig_timestamp');
+      $guid = $request->get('uid');
+      $uid_sig = $request->get('uid_sig');
 
-				$base_path = base_path();
-				$redirect_path = ($base_path === '/') ? '/' : $base_path . '/';
+      $base_path = base_path();
+      $redirect_path = ($base_path === '/') ? '/' : $base_path . '/';
 
-				$response = new AjaxResponse();
+      $response = new AjaxResponse();
 
-				if ($gigyaUser = $this->helper->validateUid($guid, $uid_sig, $sig_timestamp))
-				{
-					if (empty($gigyaUser->getLoginIDs['emails']))
-					{
-						$err_msg = $this->t(
-							'Email address is required by Drupal and is missing, please contact the site administrator.'
-						);
-						$this->helper->saveUserLogoutCookie();
-					}
-					else
-					{
-						/** @var UserInterface $user */
-						$user = $this->helper->getUidByUUID($gigyaUser->getUID());
-						if ($user)
-						{
-							/** if a user has the a permission of bypass gigya raas (admin user)
-							 *  they can't login via gigya
-							 */
-							if ($user->hasPermission('bypass gigya raas'))
-							{
-								\Drupal::logger('gigya_raas')->notice(
-									"User with email " . $user->getEmail()
-									. " that has 'bypass gigya raas' permission tried to login via gigya"
-								);
-								$this->helper->saveUserLogoutCookie();
-								$err_msg = $this->t(
-									"Oops! Something went wrong during your login/registration process. Please try to login/register again."
-								);
-								$response->addCommand(new AlertCommand($err_msg));
+      if ($gigyaUser = $this->helper->validateUid($guid, $uid_sig, $sig_timestamp)) {
+        if (empty($gigyaUser->getLoginIDs['emails'])) {
+          $err_msg = $this->t(
+          'Email address is required by Drupal and is missing, please contact the site administrator.'
+            );
+          $this->helper->saveUserLogoutCookie();
+        }
+        else {
+          /** @var \Drupal\user\Entity\UserInterface $user */
+          $user = $this->helper->getUidByUUID($gigyaUser->getUID());
+          if ($user) {
+            /** if a user has the a permission of bypass gigya raas (admin user)
+                             *  they can't login via gigya
+                             */
+            if ($user->hasPermission('bypass gigya raas')) {
+              \Drupal::logger('gigya_raas')->notice(
+              "User with email " . $user->getEmail()
+              . " that has 'bypass gigya raas' permission tried to login via gigya"
+                  );
+              $this->helper->saveUserLogoutCookie();
+              $err_msg = $this->t(
+                   "Oops! Something went wrong during your login/registration process. Please try to login/register again."
+                  );
+              $response->addCommand(new AlertCommand($err_msg));
 
-								return $response;
-							}
-							if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, $user->id()))
-							{
-								if ($user->mail !== $unique_email)
-								{
-									$user->setEmail($unique_email);
-									$user->save();
-								}
-							}
-							else
-							{
-								$this->helper->saveUserLogoutCookie();
-								$err_msg = $this->t("Email already exists");
-								$response->addCommand(new AlertCommand($err_msg));
-								return $response;
-							}
-							/* Set global variable so we would know the user as logged in
-							   RaaS in other functions down the line.*/
-							$raas_login = TRUE;
+              return $response;
+            }
+            if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, $user->id())) {
+              if ($user->mail !== $unique_email) {
+                $user->setEmail($unique_email);
+                $user->save();
+              }
+            }
+            else {
+              $this->helper->saveUserLogoutCookie();
+              $err_msg = $this->t("Email already exists");
+              $response->addCommand(new AlertCommand($err_msg));
+              return $response;
+            }
+            /* Set global variable so we would know the user as logged in
+            RaaS in other functions down the line.*/
+            $raas_login = TRUE;
 
-							/* Log the user in */
-							$this->helper->processFieldMapping($gigyaUser, $user);
-							$this->gigyaRaasExtCookieAjax($request, $raas_login);
-							$user->save();
-							user_login_finalize($user);
-						}
-						else
-						{
-							$uids = $this->helper->getUidByMails($gigyaUser->getLoginIds['emails']);
-							if (!empty($uids))
-							{
-								\Drupal::logger('gigya_raas')->notice(
-									"User with uid " . $guid . " that already exists tried to register via gigya"
-								);
-								$this->helper->saveUserLogoutCookie();
-								$err_msg = $this->t(
-									"Oops! Something went wrong during your login/registration process. Please try to login/register again."
-								);
-								$response->addCommand(new AlertCommand($err_msg));
-								return $response;
-							}
-							if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, 0))
-							{
-								$email = $unique_email;
-							}
-							else
-							{
-								$this->helper->saveUserLogoutCookie();
-								$err_msg = $this->t("Email already exists");
-								$response->addCommand(new AlertCommand($err_msg));
-								return $response;
-							}
-							$gigya_user_name = $gigyaUser->getProfile()->getUsername();
-							$uname = !empty($gigya_user_name) ? $gigyaUser->getProfile()->getUsername()
-								: $gigyaUser->getProfile()->getFirstName();
-							if (!$this->helper->getUidByName($uname))
-							{
-								$username = $uname;
-							}
-							else
-							{
-								// If user name is taken use first name if it is not empty.
-								$gigya_firstname = $gigyaUser->getProfile()->getFirstName();
-								if (!empty($gigya_firstname)
-									&& (!$this->helper->getUidByName(
-										$gigyaUser->getProfile()->getFirstName()
-									))
-								)
-								{
-									$username = $gigyaUser->getProfile()->getFirstName();
-								}
-								else
-								{
-									// When all fails add unique id  to the username so we could register the user.
-									$username = $uname . '_' . uniqid();
-								}
-							}
+            /* Log the user in */
+            $this->helper->processFieldMapping($gigyaUser, $user);
+            $this->gigyaRaasExtCookieAjax($request, $raas_login);
+            $user->save();
+            user_login_finalize($user);
+          }
+          else {
+            $uids = $this->helper->getUidByMails($gigyaUser->getLoginIds['emails']);
+            if (!empty($uids)) {
+              \Drupal::logger('gigya_raas')->notice(
+              "User with uid " . $guid . " that already exists tried to register via gigya"
+                  );
+              $this->helper->saveUserLogoutCookie();
+              $err_msg = $this->t(
+                   "Oops! Something went wrong during your login/registration process. Please try to login/register again."
+                  );
+              $response->addCommand(new AlertCommand($err_msg));
+              return $response;
+            }
+            if ($unique_email = $this->helper->checkEmailsUniqueness($gigyaUser, 0)) {
+              $email = $unique_email;
+            }
+            else {
+              $this->helper->saveUserLogoutCookie();
+              $err_msg = $this->t("Email already exists");
+              $response->addCommand(new AlertCommand($err_msg));
+              return $response;
+            }
+            $gigya_user_name = $gigyaUser->getProfile()->getUsername();
+            $uname = !empty($gigya_user_name) ? $gigyaUser->getProfile()->getUsername()
+            : $gigyaUser->getProfile()->getFirstName();
+            if (!$this->helper->getUidByName($uname)) {
+              $username = $uname;
+            }
+            else {
+              // If user name is taken use first name if it is not empty.
+              $gigya_firstname = $gigyaUser->getProfile()->getFirstName();
+              if (!empty($gigya_firstname)
+              && (!$this->helper->getUidByName(
+               $gigyaUser->getProfile()->getFirstName()
+              ))
+                  ) {
+                $username = $gigyaUser->getProfile()->getFirstName();
+              }
+              else {
+                // When all fails add unique id  to the username so we could register the user.
+                $username = $uname . '_' . uniqid();
+              }
+            }
 
-							$user = User::create(
-								array('name' => $username, 'pass' => user_password(), 'status' => 1, 'mail' => $email)
-							);
-							$user->save();
-							$this->helper->processFieldMapping($gigyaUser, $user);
-							/* Allow other modules to modify the data before user
-							is created in drupal database. */
+            $user = User::create(
+            ['name' => $username, 'pass' => user_password(), 'status' => 1, 'mail' => $email]
+               );
+            $user->save();
+            $this->helper->processFieldMapping($gigyaUser, $user);
+            /* Allow other modules to modify the data before user
+            is created in drupal database. */
 
-							\Drupal::moduleHandler()->alter('gigya_raas_create_user', $gigyaUser, $user);
-							try
-							{
-								//@TODO: generate Unique user name.
-								$user->save();
-								$raas_login = true;
-								$this->gigyaRaasExtCookieAjax($request, $raas_login);
-								user_login_finalize($user);
-							}
-							catch (\Exception $e)
-							{
-								\Drupal::logger('gigya_raas')->notice('User with username: '.$username.' could not log in after registration. Exception: '.$e->getMessage());
-								session_destroy();
-								$err_msg = $this->t(
-									"Oops! Something went wrong during your registration process. You are registered to the site but not logged-in. Please try to login again."
-								);
-								$this->helper->saveUserLogoutCookie();
+            \Drupal::moduleHandler()->alter('gigya_raas_create_user', $gigyaUser, $user);
+            try {
+              // @TODO: generate Unique user name.
+              $user->save();
+              $raas_login = TRUE;
+              $this->gigyaRaasExtCookieAjax($request, $raas_login);
+              user_login_finalize($user);
+            }
+            catch (\Exception $e) {
+              \Drupal::logger('gigya_raas')->notice('User with username: ' . $username . ' could not log in after registration. Exception: ' . $e->getMessage());
+              session_destroy();
+              $err_msg = $this->t(
+              "Oops! Something went wrong during your registration process. You are registered to the site but not logged-in. Please try to login again."
+                      );
+              $this->helper->saveUserLogoutCookie();
 
-								$response->addCommand(new InvokeCommand(NULL, 'loginRedirect', [$redirect_path]));
-							}
-						}
-					}
-				}
-				else
-				{
-					$this->helper->saveUserLogoutCookie();
-          			\Drupal::logger('gigya_raas')->notice('Invalid user. Guid: '.$guid);
-					$err_msg = $this->t(
-						"Oops! Something went wrong during your login/registration process. Please try to login/register again."
-					);
-				}
+              $response->addCommand(new InvokeCommand(NULL, 'loginRedirect', [$redirect_path]));
+            }
+          }
+        }
+      }
+      else {
+        $this->helper->saveUserLogoutCookie();
+        \Drupal::logger('gigya_raas')->notice('Invalid user. Guid: ' . $guid);
+        $err_msg = $this->t(
+        "Oops! Something went wrong during your login/registration process. Please try to login/register again."
+         );
+      }
 
-				if ($err_msg !== FALSE)
-				{
-					$response->addCommand(new AlertCommand($err_msg));
-				}
-				else
-				{
-					$response->addCommand(new InvokeCommand(NULL, 'loginRedirect', [$redirect_path]));
-				}
+      if ($err_msg !== FALSE) {
+        $response->addCommand(new AlertCommand($err_msg));
+      }
+      else {
+        $response->addCommand(new InvokeCommand(NULL, 'loginRedirect', [$redirect_path]));
+      }
 
-				return $response;
-			}
+      return $response;
+    }
 
-			return false;
-		}
+    return FALSE;
+  }
 
-		/**
-		 * Process gigya dynamic cookie request.
-		 *
-		 * @param \Symfony\Component\HttpFoundation\Request $request
-		 *   The incoming request object.
-		 * @param    boolean                                $login
-		 *
-		 * @return \Drupal\Core\Ajax\AjaxResponse
-		 *   The Ajax response
-		 */
-		public function gigyaRaasExtCookieAjax(Request $request, $login = FALSE) {
-			if ($this->shouldAddExtCookie($request, $login))
-			{
-				$gigya_conf = \Drupal::config('gigya.settings');
-				$session_ttl = \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_time');
-				$api_key = $gigya_conf->get('gigya.gigya_api_key');
-				$glt_cookie = $request->cookies->get('glt_' . $api_key);
-				$token = (!empty(explode('|', $glt_cookie)[0])) ? explode('|', $glt_cookie)[0] : NULL; /* PHP 5.4+ */
-				$now = $_SERVER['REQUEST_TIME'];
-				$expiration = strval($now + $session_ttl);
-				$helper = new GigyaHelper();
+  /**
+   * Process gigya dynamic cookie request.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The incoming request object.
+   * @param bool $login
+   *
+   * @return \Drupal\Core\Ajax\AjaxResponse
+   *   The Ajax response
+   */
+  public function gigyaRaasExtCookieAjax(Request $request, $login = FALSE) {
+    if ($this->shouldAddExtCookie($request, $login)) {
+      $gigya_conf = \Drupal::config('gigya.settings');
+      $session_ttl = \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_time');
+      $api_key = $gigya_conf->get('gigya.gigya_api_key');
+      $glt_cookie = $request->cookies->get('glt_' . $api_key);
+      $token = (!empty(explode('|', $glt_cookie)[0])) ? explode('|', $glt_cookie)[0] : NULL; /* PHP 5.4+ */
+      $now = $_SERVER['REQUEST_TIME'];
+      $expiration = strval($now + $session_ttl);
+      $helper = new GigyaHelper();
 
-				$gltexp_cookie = $request->cookies->get('gltexp_' . $api_key);
-				$gltexp_cookie_timestamp = explode('_', $gltexp_cookie)[0];
-				if (empty($gltexp_cookie_timestamp) or (time() < $gltexp_cookie_timestamp))
-				{
-					if (!empty($token))
-					{
-						$session_sig = $this->calcDynamicSessionSig(
-							$token, $expiration, $gigya_conf->get('gigya.gigya_application_key'),
-							$helper->decrypt($gigya_conf->get('gigya.gigya_application_secret_key'))
-						);
-						setrawcookie('gltexp_' . $api_key, rawurlencode($session_sig), time() + (10 * 365 * 24 * 60 * 60), '/', $request->getHost());
-					}
-				}
-			}
-			return new AjaxResponse();
-		}
+      $gltexp_cookie = $request->cookies->get('gltexp_' . $api_key);
+      $gltexp_cookie_timestamp = explode('_', $gltexp_cookie)[0];
+      if (empty($gltexp_cookie_timestamp) or (time() < $gltexp_cookie_timestamp)) {
+        if (!empty($token)) {
+          $session_sig = $this->calcDynamicSessionSig(
+          $token, $expiration, $gigya_conf->get('gigya.gigya_application_key'),
+          $helper->decrypt($gigya_conf->get('gigya.gigya_application_secret_key'))
+            );
+          setrawcookie('gltexp_' . $api_key, rawurlencode($session_sig), time() + (10 * 365 * 24 * 60 * 60), '/', $request->getHost());
+        }
+      }
+    }
+    return new AjaxResponse();
+  }
 
-		private function shouldAddExtCookie($request, $login) {
-			if ("dynamic" != \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_type'))
-			{
-				return false;
-			}
+  /**
+   *
+   */
+  private function shouldAddExtCookie($request, $login) {
+    if ("dynamic" != \Drupal::config('gigya_raas.settings')->get('gigya_raas.session_type')) {
+      return FALSE;
+    }
 
-			if ($login)
-			{
-				return true;
-			}
+    if ($login) {
+      return TRUE;
+    }
 
-			$current_user = \Drupal::currentUser();
-			if ($current_user->isAuthenticated() && !$current_user->hasPermission('bypass gigya raas'))
-			{
-				$gigya_conf = \Drupal::config('gigya.settings');
-				$api_key = $gigya_conf->get('gigya.gigya_api_key');
-				$gltexp_cookie = $request->cookies->get('gltexp_' . $api_key);
-				return !empty($gltexp_cookie);
-			}
-			return true;
-		}
+    $current_user = \Drupal::currentUser();
+    if ($current_user->isAuthenticated() && !$current_user->hasPermission('bypass gigya raas')) {
+      $gigya_conf = \Drupal::config('gigya.settings');
+      $api_key = $gigya_conf->get('gigya.gigya_api_key');
+      $gltexp_cookie = $request->cookies->get('gltexp_' . $api_key);
+      return !empty($gltexp_cookie);
+    }
+    return TRUE;
+  }
 
-		private function calcDynamicSessionSig($token, $expiration, $userKey, $secret) {
-			$unsignedExpString = utf8_encode($token . "_" . $expiration . "_" . $userKey);
-			$rawHmac = hash_hmac("sha1", utf8_encode($unsignedExpString), base64_decode($secret), TRUE);
-			$sig = base64_encode($rawHmac);
-			return $expiration . '_' . $userKey . '_' . $sig;
-		}
+  /**
+   *
+   */
+  private function calcDynamicSessionSig($token, $expiration, $userKey, $secret) {
+    $unsignedExpString = utf8_encode($token . "_" . $expiration . "_" . $userKey);
+    $rawHmac = hash_hmac("sha1", utf8_encode($unsignedExpString), base64_decode($secret), TRUE);
+    $sig = base64_encode($rawHmac);
+    return $expiration . '_' . $userKey . '_' . $sig;
+  }
 
-	}
\ No newline at end of file
+}
diff --git a/gigya_raas/src/Plugin/Block/GigyaRaasLinks.php b/gigya_raas/src/Plugin/Block/GigyaRaasLinks.php
index 1ce452d..fd5af5e 100755
--- a/gigya_raas/src/Plugin/Block/GigyaRaasLinks.php
+++ b/gigya_raas/src/Plugin/Block/GigyaRaasLinks.php
@@ -1,13 +1,4 @@
 <?php
-/**
- * Provides a 'Gigya RaaS links' Block
- *
- * @Block(
- *   id = "gigya_rass_links",
- *   admin_label = @Translation("Gigya RaaS links"),
- *   category = @Translation("Gigya")
- * )
- */
 
 namespace Drupal\gigya_raas\Plugin\Block;
 
@@ -15,50 +6,54 @@ use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Link;
 use Drupal\Core\Url;
 
-
+/**
+ *
+ */
 class GigyaRaasLinks extends BlockBase {
+
   /**
    * {@inheritdoc}
    */
   public function build() {
-    $links = array();
+    $links = [];
     if (\Drupal::currentUser()->isAnonymous()) {
       $url = Url::fromUserInput("/#");
-      $url->setOptions(array(
-        'attributes' => array(
+      $url->setOptions([
+        'attributes' => [
           'class' => 'gigya-raas-login',
           'id' => 'gigya-raas-login',
-        ),
+        ],
         'fragment' => 'raas-login',
-      ));
+      ]);
       $links['login'] = Link::fromTextAndUrl($this->t('Login'), $url);
 
       $url = Url::fromUserInput("#");
-      $url->setOptions(array(
-        'attributes' => array(
+      $url->setOptions([
+        'attributes' => [
           'class' => 'gigya-raas-reg',
           'id' => 'gigya-raas-reg',
-        ),
+        ],
         'fragment' => 'raas-register',
-      ));
+      ]);
       $links['register'] = Link::fromTextAndUrl($this->t('Register'), $url);
     }
     else {
       $url = Url::fromUserInput("#");
-      $url->setOptions(array(
-        'attributes' => array(
+      $url->setOptions([
+        'attributes' => [
           'class' => 'gigya-raas-prof',
           'id' => 'gigya-raas-prof',
-        ),
+        ],
         'fragment' => 'raas-profile',
-      ));
+      ]);
 
       $links['profile'] = Link::fromTextAndUrl($this->t('Profile'), $url);
     }
-    $build['block'] = array(
+    $build['block'] = [
       '#theme' => 'gigya_raas_links_block',
-      '#links' => $links
-    );
+      '#links' => $links,
+    ];
     return $build;
   }
+
 }
diff --git a/gigya_raas/src/Plugin/Block/GigyaRaasLogin.php b/gigya_raas/src/Plugin/Block/GigyaRaasLogin.php
index 1270466..0216553 100755
--- a/gigya_raas/src/Plugin/Block/GigyaRaasLogin.php
+++ b/gigya_raas/src/Plugin/Block/GigyaRaasLogin.php
@@ -1,30 +1,25 @@
 <?php
-/**
- * Provides a 'Gigya RaaS Login' Block
- *
- * @Block(
- *   id = "gigya_rass_login",
- *   admin_label = @Translation("Gigya RaaS Login"),
- *   category = @Translation("Gigya")
- * )
- */
 
 namespace Drupal\gigya_raas\Plugin\Block;
 
 use Drupal\Core\Block\BlockBase;
 
-
+/**
+ *
+ */
 class GigyaRaasLogin extends BlockBase {
+
   /**
    * {@inheritdoc}
    */
   public function build() {
-    $build['block'] = array(
+    $build['block'] = [
       '#theme' => 'gigya_raas_login_block',
-      '#showDiv' => \Drupal::currentUser()->isAnonymous()
-    );
+      '#showDiv' => \Drupal::currentUser()->isAnonymous(),
+    ];
     $this->setConfigurationValue('label_display', 'hidden');
 
     return $build;
   }
+
 }
diff --git a/gigya_raas/src/Plugin/Block/GigyaRaasProfile.php b/gigya_raas/src/Plugin/Block/GigyaRaasProfile.php
index cbe18cd..6b8e069 100755
--- a/gigya_raas/src/Plugin/Block/GigyaRaasProfile.php
+++ b/gigya_raas/src/Plugin/Block/GigyaRaasProfile.php
@@ -1,28 +1,23 @@
 <?php
-/**
- * Provides a 'Gigya RaaS Profile' Block
- *
- * @Block(
- *   id = "gigya_rass_profile",
- *   admin_label = @Translation("Gigya RaaS Profile"),
- *   category = @Translation("Gigya")
- * )
- */
 
 namespace Drupal\gigya_raas\Plugin\Block;
 
 use Drupal\Core\Block\BlockBase;
 
-
+/**
+ *
+ */
 class GigyaRaasProfile extends BlockBase {
+
   /**
    * {@inheritdoc}
    */
   public function build() {
-    $build['block'] = array(
+    $build['block'] = [
       '#theme' => 'gigya_raas_profile_block',
-      '#showDiv' => \Drupal::currentUser()->isAuthenticated()
-    );
+      '#showDiv' => \Drupal::currentUser()->isAuthenticated(),
+    ];
     return $build;
   }
+
 }
diff --git a/gigya_raas/src/Plugin/Block/GigyaRaasRegister.php b/gigya_raas/src/Plugin/Block/GigyaRaasRegister.php
index 5829ddb..c476a6a 100755
--- a/gigya_raas/src/Plugin/Block/GigyaRaasRegister.php
+++ b/gigya_raas/src/Plugin/Block/GigyaRaasRegister.php
@@ -1,28 +1,23 @@
 <?php
-/**
- * Provides a 'Gigya RaaS Register' Block
- *
- * @Block(
- *   id = "gigya_rass_register",
- *   admin_label = @Translation("Gigya RaaS Register"),
- *   category = @Translation("Gigya")
- * )
- */
 
 namespace Drupal\gigya_raas\Plugin\Block;
 
 use Drupal\Core\Block\BlockBase;
 
-
+/**
+ *
+ */
 class GigyaRaasRegister extends BlockBase {
+
   /**
    * {@inheritdoc}
    */
   public function build() {
-    $build['block'] = array(
+    $build['block'] = [
       '#theme' => 'gigya_raas_register_block',
-      '#showDiv' => \Drupal::currentUser()->isAnonymous()
-    );
+      '#showDiv' => \Drupal::currentUser()->isAnonymous(),
+    ];
     return $build;
   }
+
 }
diff --git a/gigya_raas/tests/src/GigyaRaasTest.php b/gigya_raas/tests/src/GigyaRaasTest.php
index a00d622..d03a70c 100755
--- a/gigya_raas/tests/src/GigyaRaasTest.php
+++ b/gigya_raas/tests/src/GigyaRaasTest.php
@@ -1,103 +1,94 @@
 <?php
 
-	/**
-	 * @file
-	 * Contains \Drupal\Tests\gigya\Functional\GigyaTest.
-	 */
-
-	namespace Drupal\Tests\gigya\gigya_raas\tests;
-
-	use Drupal;
-	use Drupal\Core\Ajax\AjaxResponse;
-	use Drupal\Core\Ajax\AlertCommand;
-	use Drupal\Core\Ajax\RedirectCommand;
-	use Drupal\Core\Form\FormState;
-	use Drupal\gigya_raas\GigyaController;
-	use Drupal\Tests\BrowserTestBase;
-	use Gigya\CmsStarterKit\sdk\GSApiException;
-	use Gigya\CmsStarterKit\sdk\GSResponse;
-	use Gigya\CmsStarterKit\user\GigyaUser;
-	use Gigya\CmsStarterKit\user\GigyaUserFactory;
-	use Drupal\user\Entity\User;
-
-	/**
-	 * Tests Gigya module functionality.
-	 *
-	 * @group gigya
-	 */
-	class GigyaTest extends BrowserTestBase
-	{
-		private $key = "24c370c0d169a482ae1c5db1932b4b29";
-		private $trueKey = "24c370c0d169a482ae1c5db1932b4b29";
-
-		/**
-		 * @var    GigyaController $gigyaControl
-		 */
-		private $gigyaControl;
-		private $requestMock;
-		/**
-		 * @var    AjaxResponse $successResponse
-		 */
-		private $successResponse = "";
-
-		/**
-		 * Modules to enable.
-		 *
-		 * @var array
-		 */
-		public static $modules = array('gigya', 'gigya_raas');
-
-		/**
-		 * The user for tests.
-		 *
-		 * @var \Drupal\user\UserInterface
-		 */
-		protected $webUser;
-
-		/**
-		 * The user for tests.
-		 *
-		 * @var \Drupal\user\UserInterface
-		 */
-		protected $gigyaAdmin;
-
-		protected $helperMock;
-
-		/**
-		 * @var    GigyaUser $gigyaUser
-		 */
-		protected $gigyaUser;
-
-		/**
-		 * {@inheritdoc}
-		 */
-		public function setUp() {
-			parent::setUp();
-
-			$this->successResponse = new AjaxResponse();
-			$this->successResponse->addCommand(new RedirectCommand("/"));
-
-			$this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
-
-			$this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
-			$this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
-				->setMethods(array('getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'))
-				->getMock();
-
-			$key = $this->key;
-			$this->helperMock->expects($this->any())->method('validateUid')->will($this->returnCallback(function() use ($key) {
-				if ($this->key == $this->trueKey)
-				{
-					return $this->gigyaUser;
-				}
-				else
-				{
-					return false;
-				}
-			}));
-
-			$method = "accounts.getAccountInfo";
-			$json = '{
+namespace Drupal\Tests\gigya\gigya_raas\tests;
+
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\AlertCommand;
+use Drupal\Core\Ajax\RedirectCommand;
+use Drupal\Core\Form\FormState;
+use Drupal\gigya_raas\GigyaController;
+use Drupal\Tests\BrowserTestBase;
+use Gigya\CmsStarterKit\sdk\GSApiException;
+use Gigya\CmsStarterKit\sdk\GSResponse;
+use Gigya\CmsStarterKit\user\GigyaUser;
+use Gigya\CmsStarterKit\user\GigyaUserFactory;
+use Drupal\user\Entity\User;
+
+/**
+ * Tests Gigya module functionality.
+ *
+ * @group gigya
+ */
+class GigyaTest extends BrowserTestBase {
+  private $key = "24c370c0d169a482ae1c5db1932b4b29";
+  private $trueKey = "24c370c0d169a482ae1c5db1932b4b29";
+
+  /**
+   * @var    \Drupal\gigya_raas\GigyaController
+   */
+  private $gigyaControl;
+  private $requestMock;
+  /**
+   * @var    \Drupal\Core\Ajax\AjaxResponse
+   */
+  private $successResponse = "";
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['gigya', 'gigya_raas'];
+
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $webUser;
+
+  /**
+   * The user for tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $gigyaAdmin;
+
+  protected $helperMock;
+
+  /**
+   * @var    \Gigya\CmsStarterKit\user\GigyaUser
+   */
+  protected $gigyaUser;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    $this->successResponse = new AjaxResponse();
+    $this->successResponse->addCommand(new RedirectCommand("/"));
+
+    $this->requestMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
+
+    $this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
+    $this->helperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
+      ->setMethods(['getEncryptKey', 'checkEncryptKey', 'sendApiCall', 'validateUid'])
+      ->getMock();
+
+    $key = $this->key;
+    $this->helperMock->expects($this->any())->method('validateUid')->will($this->returnCallback(function () use ($key) {
+      if ($this->key == $this->trueKey) {
+        return $this->gigyaUser;
+      }
+      else {
+        return FALSE;
+      }
+    }));
+
+    $method = "accounts.getAccountInfo";
+    $json = '{
   "UID": "_guid_-SPzNo7usObOUAUKT0KC-yijanD1CTN4n-syLkRjj5k=",
   "UIDSignature": "cTXiwusSZP3b/VpAZ9ik2PDvAI0=",
   "signatureTimestamp": "1465860265",
@@ -228,151 +219,145 @@
   "time": "2016-06-13T23:24:25.466Z"
 }';
 
-			$res = new GSResponse($method, $json, null, 0, null, array());
-
-			$dataArray = $res->getData()->serialize();
-			$profileArray = $dataArray['profile'];
-			$gigyaUser = GigyaUserFactory::createGigyaUserFromArray($dataArray);
-			$gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
-			$gigyaUser->setProfile($gigyaProfile);
-			$this->gigyaUser = $gigyaUser;
-
-
-			$this->helperMock
-				->expects($this->any())
-				->method('sendApiCall')
-				->will($this->returnCallback(function($method, $params, $access_params) {
-					$aparams = array();
-					$aparams['api_key'] = 'apikey';
-					$aparams['session_time'] = 'appsecret';
-					$aparams['app_key'] = 'appkey';
-					$aparams['data_center'] = 'us1.gigya.com';
-					if ($access_params !== $aparams)
-					{
-						if ($access_params['api_key'] !== $aparams['api_key'])
-						{
-							$err_number = 400093;
-							$err_message = "Invalid ApiKey parameter";
-						}
-						elseif ($access_params['app_key'] !== $aparams['app_key'])
-						{
-							$err_number = 403005;
-							$err_message = "Unauthorized user";
-						}
-						elseif ($access_params['app_secret'] !== $aparams['app_secret'])
-						{
-							$err_number = 403003;
-							$err_message = "Invalid request signature";
-						}
-						elseif ($access_params['data_center'] !== $aparams['data_center'])
-						{
-							$err_number = 301001;
-							$err_message = "Invalid data center";
-						}
-						else
-						{
-							$err_message = '';
-							$err_number = 0;
-						}
-
-						$res = new GSApiException($err_message, $err_number, $err_message);
-					}
-					elseif ($method == 'shortenURL')
-					{
-						$responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
-						$res = new GSResponse('shortenURL', $responseStr);
-
-					}
-
-					return $res;
-				}));
-
-			$this->gigyaControl = new GigyaController($this->helperMock);
-		}
-
-		/**
-		 * Tests encrypt.
-		 */
-		public function testEncrypt() {
-//    2. Give the user permission in Gigya Role and load Gigya settings page
-//       Expected: 1. secret keys is visible.
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalGet('admin/config/gigya/raas/session');
-			$this->assertSession()->statusCodeEquals('200');
-
-			//    $config = Drupal::service('config.factory')->getEditable('gigya.settings')->set('gigya.gigya_application_secret_key', 'a');
-//    $config->save();
-
-//  3. Set Gigya apikey, user app and secret and DC and save settings
-//     Expected: Settings saved secret encrypt on DB and in logs doesnt appear
-
-			$form_state = new FormState();
-			$values['session_type'] = 'dynamic';
-			$values['session_time'] = '1800';
-			$form_state->setValues($values);
-
-			/** @noinspection PhpMethodParametersCountMismatchInspection */
-			\Drupal::formBuilder()->submitForm('Drupal\gigya_raas\Form\GigyaSessionForm', $form_state, $this->helperMock);
-
-			$this->drupalLogout();
-
-			//@TODO: check logs.
-			//Set other setting and register from front-site without required field - email, enable debug mode
-			//Expected:
-			//1. Error for missing email appears to user
-			//2. Secret doesn't appear in any messages in the logs
-
-			$email = $this->gigyaUser->getProfile()->getEmail();
-			$this->gigyaUser->getProfile()->setEmail("");
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-
-			$response = new AjaxResponse();
-			$err_msg = t('Email address is required by Drupal and is missing, please contact the site administrator.');
-			$response->addCommand(new AlertCommand($err_msg));
-			$this->assertEquals($response->getCommands(), $res->getCommands());
-
-//  Set email with required field and register
-//  Expected:
-//  1.Registration succeed, user appears in Drupal users list
-//  2. Secret doesn't appear in any messages in the logs
-//  3. getAccountInfo fired without any error
-
-			$this->gigyaUser->getProfile()->setEmail($email);
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-			$user = User::load(\Drupal::currentUser()->id());
-			$this->assertTrue(\Drupal::currentUser()->isAuthenticated());
-
-			$this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
-			$this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
-		}
-
-		public function checkGoodLogin() {
-
-			$res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
-			$this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
-			$this->assertTrue(\Drupal::currentUser()->isAuthenticated());
-
-		}
-
-		public function testUI() {
-			$this->drupalLogin($this->gigyaAdmin);
-			$this->drupalGet('admin/config/gigya/raas/session');
-			$this->assertSession()->statusCodeEquals('200');
-			$this->assertSession()->elementExists('css', '#edit-session-type-fixed');
-			$this->assertSession()->elementExists('css', '#edit-session-type-dynamic');
-			$this->assertSession()->elementExists('css', '#edit-session-time');
-			$this->assertSession()->elementExists('css', '#edit-submit');
-
-			$form_state = new FormState();
-			$values['session_type'] = 'dynamic';
-			$values['session_time'] = '1800';
-			$form_state->setValues($values);
-
-			\Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaSessionForm', $form_state, $this->helperMock);
-			$msg = drupal_get_messages();
-			$this->assertArrayNotHasKey('error', $msg);
-			$this->drupalLogout();
-
-
-		}
-	}
+    $res = new GSResponse($method, $json, NULL, 0, NULL, []);
+
+    $dataArray = $res->getData()->serialize();
+    $profileArray = $dataArray['profile'];
+    $gigyaUser = GigyaUserFactory::createGigyaUserFromArray($dataArray);
+    $gigyaProfile = GigyaUserFactory::createGigyaProfileFromArray($profileArray);
+    $gigyaUser->setProfile($gigyaProfile);
+    $this->gigyaUser = $gigyaUser;
+
+    $this->helperMock
+      ->expects($this->any())
+      ->method('sendApiCall')
+      ->will($this->returnCallback(function ($method, $params, $access_params) {
+         $aparams = [];
+         $aparams['api_key'] = 'apikey';
+         $aparams['session_time'] = 'appsecret';
+         $aparams['app_key'] = 'appkey';
+         $aparams['data_center'] = 'us1.gigya.com';
+        if ($access_params !== $aparams) {
+          if ($access_params['api_key'] !== $aparams['api_key']) {
+            $err_number = 400093;
+            $err_message = "Invalid ApiKey parameter";
+          }
+          elseif ($access_params['app_key'] !== $aparams['app_key']) {
+            $err_number = 403005;
+            $err_message = "Unauthorized user";
+          }
+          elseif ($access_params['app_secret'] !== $aparams['app_secret']) {
+            $err_number = 403003;
+            $err_message = "Invalid request signature";
+          }
+          elseif ($access_params['data_center'] !== $aparams['data_center']) {
+            $err_number = 301001;
+            $err_message = "Invalid data center";
+          }
+          else {
+            $err_message = '';
+            $err_number = 0;
+          }
+
+          $res = new GSApiException($err_message, $err_number, $err_message);
+        }
+        elseif ($method == 'shortenURL') {
+          $responseStr = '{"shortURL": "http://fw.to/8WgRfqE","statusCode": 200,"errorCode": 0,"statusReason": "OK","callId": "968875481ea94aadb8dc146a7165926c","time": "2016-06-09T13:07:20.861Z"}';
+          $res = new GSResponse('shortenURL', $responseStr);
+
+        }
+
+         return $res;
+      }));
+
+    $this->gigyaControl = new GigyaController($this->helperMock);
+  }
+
+  /**
+   * Tests encrypt.
+   */
+  public function testEncrypt() {
+    // 2. Give the user permission in Gigya Role and load Gigya settings page
+    //    Expected: 1. secret keys is visible.
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalGet('admin/config/gigya/raas/session');
+    $this->assertSession()->statusCodeEquals('200');
+
+    // $config = Drupal::service('config.factory')->getEditable('gigya.settings')->set('gigya.gigya_application_secret_key', 'a');
+    //    $config->save();
+    //  3. Set Gigya apikey, user app and secret and DC and save settings
+    //     Expected: Settings saved secret encrypt on DB and in logs doesnt appear.
+    $form_state = new FormState();
+    $values['session_type'] = 'dynamic';
+    $values['session_time'] = '1800';
+    $form_state->setValues($values);
+
+    /** @noinspection PhpMethodParametersCountMismatchInspection */
+    \Drupal::formBuilder()->submitForm('Drupal\gigya_raas\Form\GigyaSessionForm', $form_state, $this->helperMock);
+
+    $this->drupalLogout();
+
+    // @TODO: check logs.
+    // Set other setting and register from front-site without required field - email, enable debug mode
+    // Expected:
+    // 1. Error for missing email appears to user
+    // 2. Secret doesn't appear in any messages in the logs
+    $email = $this->gigyaUser->getProfile()->getEmail();
+    $this->gigyaUser->getProfile()->setEmail("");
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+
+    $response = new AjaxResponse();
+    $err_msg = t('Email address is required by Drupal and is missing, please contact the site administrator.');
+    $response->addCommand(new AlertCommand($err_msg));
+    $this->assertEquals($response->getCommands(), $res->getCommands());
+
+    // Set email with required field and register
+    //  Expected:
+    //  1.Registration succeed, user appears in Drupal users list
+    //  2. Secret doesn't appear in any messages in the logs
+    //  3. getAccountInfo fired without any error.
+    $this->gigyaUser->getProfile()->setEmail($email);
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+    $user = User::load(\Drupal::currentUser()->id());
+    $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
+
+    $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
+    $this->assertEquals($this->gigyaUser->getProfile()->getEmail(), $user->getEmail());
+  }
+
+  /**
+   *
+   */
+  public function checkGoodLogin() {
+
+    $res = $this->gigyaControl->gigyaRaasLoginAjax($this->requestMock);
+    $this->assertEquals($this->successResponse->getCommands(), $res->getCommands());
+    $this->assertTrue(\Drupal::currentUser()->isAuthenticated());
+
+  }
+
+  /**
+   *
+   */
+  public function testUI() {
+    $this->drupalLogin($this->gigyaAdmin);
+    $this->drupalGet('admin/config/gigya/raas/session');
+    $this->assertSession()->statusCodeEquals('200');
+    $this->assertSession()->elementExists('css', '#edit-session-type-fixed');
+    $this->assertSession()->elementExists('css', '#edit-session-type-dynamic');
+    $this->assertSession()->elementExists('css', '#edit-session-time');
+    $this->assertSession()->elementExists('css', '#edit-submit');
+
+    $form_state = new FormState();
+    $values['session_type'] = 'dynamic';
+    $values['session_time'] = '1800';
+    $form_state->setValues($values);
+
+    \Drupal::formBuilder()->submitForm('Drupal\gigya\Form\GigyaSessionForm', $form_state, $this->helperMock);
+    $msg = drupal_get_messages();
+    $this->assertArrayNotHasKey('error', $msg);
+    $this->drupalLogout();
+
+  }
+
+}
diff --git a/gigya_user_deletion/gigya_user_deletion.api.php b/gigya_user_deletion/gigya_user_deletion.api.php
index b07d276..d77836d 100755
--- a/gigya_user_deletion/gigya_user_deletion.api.php
+++ b/gigya_user_deletion/gigya_user_deletion.api.php
@@ -1,24 +1,24 @@
 <?php
+
 /**
+ * @file
  * Created by PhpStorm.
  * User: Inbal.Zi
  * Date: 11/8/2017
- * Time: 7:16 PM
+ * Time: 7:16 PM.
  */
 
-
 /**
  * Modify the data gigya_delete_user before it is added to the js.
  *
- * @param $user (CMS)
+ * @param CMS $user
  *
  * @see CKEditorPluginManager
  */
 function hook_gigya_delete_user_alter(&$user, &$res) {
-    if ($user->get('uid')->value === "14")
-    {
-        $res = FALSE;
-        return;
-    }
-    $res = TRUE;
-}
\ No newline at end of file
+  if ($user->get('uid')->value === "14") {
+    $res = FALSE;
+    return;
+  }
+  $res = TRUE;
+}
diff --git a/gigya_user_deletion/gigya_user_deletion.install b/gigya_user_deletion/gigya_user_deletion.install
index fc78223..87b3164 100755
--- a/gigya_user_deletion/gigya_user_deletion.install
+++ b/gigya_user_deletion/gigya_user_deletion.install
@@ -1,35 +1,36 @@
 <?php
-	/**
-	 * @file
-	 * Installation functions for Gigya module.
-	 */
 
-	/**
-	 * Implements hook_schema().
-	 *
-	 * Defines a new DB table used by Gigya User Deletion.
-	 *
-	 * @ingroup gigya_user_deletion
-	 */
-	function gigya_user_deletion_schema() {
-		$schema['gigya_user_deletion'] = array(
-			'description' => '',
-			'fields'      => array(
-				'filename' => array(
-					'type'        => 'varchar',
-					'length'      => 127,
-					'not null'    => true,
-					'description' => 'File name processed',
-				),
-				'time_processed'     => array(
-					'type'        => 'int',
-					'description' => 'Timestamp of the cron run when this file was successfully processed',
-				),
-			),
-			'primary key' => array(
-				'filename',
-			),
-		);
+    /**
+     * @file
+     * Installation functions for Gigya module.
+     */
 
-		return $schema;
-	}
\ No newline at end of file
+    /**
+     * Implements hook_schema().
+     *
+     * Defines a new DB table used by Gigya User Deletion.
+     *
+     * @ingroup gigya_user_deletion
+     */
+    function gigya_user_deletion_schema() {
+  $schema['gigya_user_deletion'] = [
+    'description' => '',
+    'fields'      => [
+      'filename' => [
+        'type'        => 'varchar',
+        'length'      => 127,
+        'not null'    => TRUE,
+        'description' => 'File name processed',
+      ],
+      'time_processed'     => [
+        'type'        => 'int',
+        'description' => 'Timestamp of the cron run when this file was successfully processed',
+      ],
+    ],
+    'primary key' => [
+      'filename',
+    ],
+  ];
+
+  return $schema;
+    }
diff --git a/gigya_user_deletion/gigya_user_deletion.module b/gigya_user_deletion/gigya_user_deletion.module
index b8d098c..6fe7afd 100755
--- a/gigya_user_deletion/gigya_user_deletion.module
+++ b/gigya_user_deletion/gigya_user_deletion.module
@@ -1,252 +1,241 @@
 <?php
-	/**
-	 * @file    Hooks for this module
-	 */
-
-	use Drupal\gigya\Helper\GigyaHelper;
-	use Drupal\gigya_user_deletion\Helper\GigyaUserDeletionHelper;
-
-	/**
-	 * Implements hook_page_attachments().
-	 *
-	 * @param array $attachments
-	 */
-	function gigya_user_deletion_page_attachments(array &$attachments) {
-		\Drupal::moduleHandler()->invoke('gigya_user_deletion', 'job_cron');
-	}
-
-	function delete_uid_queue_name() {
-		return 'delete_uid_queue';
-	}
-
-	/**
-	 * Implements hook_cron().
-	 */
-	function gigya_user_deletion_cron() {
-		$enable_job = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.enableJob');
-
-		/* Get counters from DB or set 0 if null */
-		$counter_succeed = \Drupal::state()->get('gigya_deletion_job.counter_succeed', 0);
-		$counter_failed = \Drupal::state()->get('gigya_deletion_job.counter_failed', 0);
-
-		$messageSuccess = "User successfully deleted from CMS - Drupal UID: @drupalUid, Gigya UID: @gigyaUid";
-		if ($enable_job)
-		{
-			\Drupal::logger('gigya_user_deletion')->info('Gigya cron started');
-
-			$gigyaHelper = new GigyaHelper();
-			$userDeletionHelper = new GigyaUserDeletionHelper();
-
-			/* Job frequency */
-			$job_frequency = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.jobFrequency');
-			/* Deletion type */
-			$deletion_type = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.deletionType');
-			/* Request time */
-			$request_time = \Drupal::time()->getRequestTime();
-			/* Get last run */
-			$last_run = \Drupal::state()->get('gigya_deletion_job.last_run', 0);
-			/* Creates a new queue file */
-			$queue_file = \Drupal::queue('job_queue_file');
-			$queue_file->createQueue();
-			// Create queue_users
-			$queue_users = \Drupal::queue('job_queue_users');
-			$queue_users->createQueue();
-
-			/* If x seconds passed since last time add file to queue_file */
-			if (($request_time - $last_run) > $job_frequency)
-			{
-				/* Get files from S3 */
-				$files = $userDeletionHelper->getFileList();
-				$queue_file = \Drupal::queue('job_queue_file');
-				$last_run = \Drupal::state()->get('gigya_deletion_job.last_run', 0);
-
-				/* Add files to queue */
-				$files_added = array();
-				if (!empty($files))
-				{
-					foreach ($files as $file) {
-						$files_processed = \Drupal::database()
-						  ->select('gigya_user_deletion')
-						  ->fields('gigya_user_deletion', [
-							'filename',
-						  ])
-						  ->orderBy('filename', 'ASC')
-						  ->execute()
-						  ->fetchCol();
-
-						/* Add item - file to queue_file and DB */
-						$file_name = ((array) $file)['Key'];
-						if (!in_array($file_name, $files_processed))
-						{
-							if (!empty(pathinfo($file_name)['extension']) and pathinfo($file_name)['extension'] === 'csv') {
-								$queue_file->createItem($file);
-								$files_added[] = $file_name;
-								try {
-									/* Insert processed files into DB */
-									\Drupal::database()
-									  ->merge('gigya_user_deletion')
-									  ->key('filename', $file_name)
-									  ->insertFields([
-										'filename' => $file_name,
-										'time_processed' => time(),
-									  ])
-									  ->updateFields([
-										'time_processed' => time(),
-									  ])
-									  ->execute();
-								} catch (\Exception $e) {
-									\Drupal::logger('gigya_user_deletion')
-									  ->error('Unable to insert file name: ' . $file_name . ' to database.');
-								}
-							}
-						}
-					}
-				}
-
-				/* Save counter value on DB and add to log */
-				$queue_files_counter = $queue_file->numberOfItems();
-				\Drupal::state()
-				  ->set('gigya_deletion_job.queue_files_counter', $queue_files_counter);
-				\Drupal::logger('gigya_user_deletion')
-				  ->info($queue_files_counter . ' files added to the queue on ' . date('Y-m-d \a\t H:i:s', \Drupal::time()
-					  ->getRequestTime()) . ': ' . implode(', ', $files_added));
-			}
-
-			/* If queue_file is not empty take item (file) and add all users to queue_users */
-			while ($queue_file->numberOfItems() > 0)
-			{
-				$item_file = $queue_file->claimItem();
-
-				if ($item_file !== false)
-				{
-					$item_array = (array) $item_file;
-					$file = $item_array['data']['Key'];
-					if ($file !== null)
-					{
-						$accounts = $userDeletionHelper->getUsers($file);
-						foreach ($accounts as $account)
-						{
-							foreach ($account as $gigya_uid)
-							{
-								/* Add item - account to queue_users */
-								$item_user = array('gigya_uid' => $gigya_uid);
-								$queue_users->createItem($item_user);
-							}
-						}
-					}
-				}
-
-				/* Remove the file from the queue_file */
-				$queue_file->deleteItem($item_file);
-			}
-
-			/* Update last run when file queue is empty */
-			\Drupal::state()->set('gigya_deletion_job.last_run', $request_time );
-
-			/* Claim uid from queue_users and delete it */
-			while ($queue_users->numberOfItems() > 0)
-			{
-				$item_user = $queue_users->claimItem();
-
-				if (!empty($item_user))
-				{
-					$item_array = (array) $item_user;
-
-					$uid = $item_array['data']['gigya_uid'];
-					if ($user = $gigyaHelper->getUidByUUID($uid)) {
-						try {
-							$drupal_uid = $user->get('uid')->value;
-							if ($deletion_type === 'hard') {
-								user_delete($drupal_uid);
-								$counter_succeed++;
-								\Drupal::state()
-								  ->set('gigya_deletion_job.counter_succeed', $counter_succeed);
-								\Drupal::logger('gigya_user_deletion')
-								  ->notice($messageSuccess, [
-									'@drupalUid' => $drupal_uid,
-									'@gigyaUid' => $uid,
-								  ]);
-							}
-							elseif ($deletion_type === 'soft') {
-								\Drupal::service('user.data')
-								  ->set('gigya_user_deletion', $drupal_uid, 'is_deleted', TRUE);
-								\Drupal::service('user.data')
-								  ->set('gigya_user_deletion', $drupal_uid, 'deleted_time', time());
-							}
-						} catch (\Exception $e) {
-							\Drupal::logger('gigya_user_deletion')
-							  ->error('Failed to delete UID ' . $user->get('uid')->value . ' from CMS with error - ' . $e);
-							$counter_failed++;
-							\Drupal::state()
-							  ->set('gigya_deletion_job.counter_failed', $counter_failed);
-						}
-					}
-					else {
-						\Drupal::logger('gigya_user_deletion')
-						  ->warning('Failed to delete UID ' . $uid . ' from CMS with error - user doesn\'t exist');
-						$counter_failed++;
-						\Drupal::state()
-						  ->set('gigya_deletion_job.counter_failed', $counter_failed);
-					}
-
-					$queue_users->deleteItem($item_user);
-				}
-			}
-
-			if (($queue_users->numberOfItems() == 0) && ($queue_file->numberOfItems() == 0))
-			{
-				/* If full or partial success */
-				if ($counter_succeed > 0)
-				{
-					$total = $counter_failed + $counter_succeed;
-
-					/* If completed with errors */
-					if ($counter_failed > 0)
-					{
-						$subject = 'User deletion job completed with errors';
-						$message = 'The user deletion job scheduled to run for ' . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' completed with errors. ' . $counter_succeed . ' out of ' . $total . ' users were deleted.';
-					}
-					/* Send email on success */
-					else
-					{
-						$subject = "Users deleted successfully";
-						$message = "The user deletion job scheduled to run for " . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' completed successfully. ' . $counter_succeed . ' out of ' . $total . ' users were deleted.';
-					}
-					$to = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.emailOnSuccess');
-					$userDeletionHelper->sendEmail($subject, $message, $to);
-				}
-
-				/* If job failed, send email */
-				elseif ($counter_failed > 0)
-				{
-					$subject = "Failed to delete users";
-					$message = "The user deletion job scheduled to run for " . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' has failed. No users were deleted.';
-					$to = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.emailOnFailure');
-					$userDeletionHelper->sendEmail($subject, $message, $to);
-				}
-
-				/* Reset counters on DB */
-				\Drupal::state()->set('gigya_deletion_job.counter_succeed', 0);
-				\Drupal::state()->set('gigya_deletion_job.counter_failed', 0);
-			}
-		}
-		else
-		{
-			\Drupal::logger('gigya_user_deletion')->warning('Gigya cron installed but not enabled. No action taken.');
-		}
-	}
-
-	/**
-	 * Implement hook_mail()
-	 *
-	 * {@inheritdoc}
-	 */
-	function gigya_user_deletion_mail($key, &$message, $params) {
-		$options = array(
-			'langcode' => $message['langcode'],
-		);
-
-		$message['from'] = \Drupal::config('system.site')->get('mail');
-		$message['subject'] = t($params['subject'], array(), $options);
-		$message['body'][] = $params['message'];
-	}
\ No newline at end of file
+
+    /**
+     * @file Hooks for this module.
+     */
+
+    use Drupal\gigya\Helper\GigyaHelper;
+use Drupal\gigya_user_deletion\Helper\GigyaUserDeletionHelper;
+
+/**
+ * Implements hook_page_attachments().
+ *
+ * @param array $attachments
+ */
+function gigya_user_deletion_page_attachments(array &$attachments) {
+  \Drupal::moduleHandler()->invoke('gigya_user_deletion', 'job_cron');
+}
+
+/**
+ *
+ */
+function delete_uid_queue_name() {
+  return 'delete_uid_queue';
+}
+
+/**
+ * Implements hook_cron().
+ */
+function gigya_user_deletion_cron() {
+  $enable_job = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.enableJob');
+
+  /* Get counters from DB or set 0 if null */
+  $counter_succeed = \Drupal::state()->get('gigya_deletion_job.counter_succeed', 0);
+  $counter_failed = \Drupal::state()->get('gigya_deletion_job.counter_failed', 0);
+
+  $messageSuccess = "User successfully deleted from CMS - Drupal UID: @drupalUid, Gigya UID: @gigyaUid";
+  if ($enable_job) {
+    \Drupal::logger('gigya_user_deletion')->info('Gigya cron started');
+
+    $gigyaHelper = new GigyaHelper();
+    $userDeletionHelper = new GigyaUserDeletionHelper();
+
+    /* Job frequency */
+    $job_frequency = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.jobFrequency');
+    /* Deletion type */
+    $deletion_type = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.deletionType');
+    /* Request time */
+    $request_time = \Drupal::time()->getRequestTime();
+    /* Get last run */
+    $last_run = \Drupal::state()->get('gigya_deletion_job.last_run', 0);
+    /* Creates a new queue file */
+    $queue_file = \Drupal::queue('job_queue_file');
+    $queue_file->createQueue();
+    // Create queue_users.
+    $queue_users = \Drupal::queue('job_queue_users');
+    $queue_users->createQueue();
+
+    /* If x seconds passed since last time add file to queue_file */
+    if (($request_time - $last_run) > $job_frequency) {
+      /* Get files from S3 */
+      $files = $userDeletionHelper->getFileList();
+      $queue_file = \Drupal::queue('job_queue_file');
+      $last_run = \Drupal::state()->get('gigya_deletion_job.last_run', 0);
+
+      /* Add files to queue */
+      $files_added = [];
+      if (!empty($files)) {
+        foreach ($files as $file) {
+          $files_processed = \Drupal::database()
+            ->select('gigya_user_deletion')
+            ->fields('gigya_user_deletion', [
+              'filename',
+            ])
+            ->orderBy('filename', 'ASC')
+            ->execute()
+            ->fetchCol();
+
+          /* Add item - file to queue_file and DB */
+          $file_name = ((array) $file)['Key'];
+          if (!in_array($file_name, $files_processed)) {
+            if (!empty(pathinfo($file_name)['extension']) and pathinfo($file_name)['extension'] === 'csv') {
+              $queue_file->createItem($file);
+              $files_added[] = $file_name;
+              try {
+                /* Insert processed files into DB */
+                \Drupal::database()
+                  ->merge('gigya_user_deletion')
+                  ->key('filename', $file_name)
+                  ->insertFields([
+                    'filename' => $file_name,
+                    'time_processed' => time(),
+                  ])
+                  ->updateFields([
+                    'time_processed' => time(),
+                  ])
+                  ->execute();
+              }
+              catch (\Exception $e) {
+                \Drupal::logger('gigya_user_deletion')
+                  ->error('Unable to insert file name: ' . $file_name . ' to database.');
+              }
+            }
+          }
+        }
+      }
+
+      /* Save counter value on DB and add to log */
+      $queue_files_counter = $queue_file->numberOfItems();
+      \Drupal::state()
+        ->set('gigya_deletion_job.queue_files_counter', $queue_files_counter);
+      \Drupal::logger('gigya_user_deletion')
+        ->info($queue_files_counter . ' files added to the queue on ' . date('Y-m-d \a\t H:i:s', \Drupal::time()
+          ->getRequestTime()) . ': ' . implode(', ', $files_added));
+    }
+
+    /* If queue_file is not empty take item (file) and add all users to queue_users */
+    while ($queue_file->numberOfItems() > 0) {
+      $item_file = $queue_file->claimItem();
+
+      if ($item_file !== FALSE) {
+        $item_array = (array) $item_file;
+        $file = $item_array['data']['Key'];
+        if ($file !== NULL) {
+          $accounts = $userDeletionHelper->getUsers($file);
+          foreach ($accounts as $account) {
+            foreach ($account as $gigya_uid) {
+              /* Add item - account to queue_users */
+              $item_user = ['gigya_uid' => $gigya_uid];
+              $queue_users->createItem($item_user);
+            }
+          }
+        }
+      }
+
+      /* Remove the file from the queue_file */
+      $queue_file->deleteItem($item_file);
+    }
+
+    /* Update last run when file queue is empty */
+    \Drupal::state()->set('gigya_deletion_job.last_run', $request_time);
+
+    /* Claim uid from queue_users and delete it */
+    while ($queue_users->numberOfItems() > 0) {
+      $item_user = $queue_users->claimItem();
+
+      if (!empty($item_user)) {
+        $item_array = (array) $item_user;
+
+        $uid = $item_array['data']['gigya_uid'];
+        if ($user = $gigyaHelper->getUidByUUID($uid)) {
+          try {
+            $drupal_uid = $user->get('uid')->value;
+            if ($deletion_type === 'hard') {
+              user_delete($drupal_uid);
+              $counter_succeed++;
+              \Drupal::state()
+                ->set('gigya_deletion_job.counter_succeed', $counter_succeed);
+              \Drupal::logger('gigya_user_deletion')
+                ->notice($messageSuccess, [
+                  '@drupalUid' => $drupal_uid,
+                  '@gigyaUid' => $uid,
+                ]);
+            }
+            elseif ($deletion_type === 'soft') {
+              \Drupal::service('user.data')
+                ->set('gigya_user_deletion', $drupal_uid, 'is_deleted', TRUE);
+              \Drupal::service('user.data')
+                ->set('gigya_user_deletion', $drupal_uid, 'deleted_time', time());
+            }
+          }
+          catch (\Exception $e) {
+            \Drupal::logger('gigya_user_deletion')
+              ->error('Failed to delete UID ' . $user->get('uid')->value . ' from CMS with error - ' . $e);
+            $counter_failed++;
+            \Drupal::state()
+              ->set('gigya_deletion_job.counter_failed', $counter_failed);
+          }
+        }
+        else {
+          \Drupal::logger('gigya_user_deletion')
+            ->warning('Failed to delete UID ' . $uid . ' from CMS with error - user doesn\'t exist');
+          $counter_failed++;
+          \Drupal::state()
+            ->set('gigya_deletion_job.counter_failed', $counter_failed);
+        }
+
+        $queue_users->deleteItem($item_user);
+      }
+    }
+
+    if (($queue_users->numberOfItems() == 0) && ($queue_file->numberOfItems() == 0)) {
+      /* If full or partial success */
+      if ($counter_succeed > 0) {
+        $total = $counter_failed + $counter_succeed;
+
+        /* If completed with errors */
+        if ($counter_failed > 0) {
+          $subject = 'User deletion job completed with errors';
+          $message = 'The user deletion job scheduled to run for ' . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' completed with errors. ' . $counter_succeed . ' out of ' . $total . ' users were deleted.';
+        }
+        /* Send email on success */
+        else {
+          $subject = "Users deleted successfully";
+          $message = "The user deletion job scheduled to run for " . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' completed successfully. ' . $counter_succeed . ' out of ' . $total . ' users were deleted.';
+        }
+        $to = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.emailOnSuccess');
+        $userDeletionHelper->sendEmail($subject, $message, $to);
+      }
+
+      /* If job failed, send email */
+      elseif ($counter_failed > 0) {
+        $subject = "Failed to delete users";
+        $message = "The user deletion job scheduled to run for " . $_SERVER['SERVER_NAME'] . ' on ' . date('F j, Y \a\t H:i:s', $last_run) . ' has failed. No users were deleted.';
+        $to = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.emailOnFailure');
+        $userDeletionHelper->sendEmail($subject, $message, $to);
+      }
+
+      /* Reset counters on DB */
+      \Drupal::state()->set('gigya_deletion_job.counter_succeed', 0);
+      \Drupal::state()->set('gigya_deletion_job.counter_failed', 0);
+    }
+  }
+  else {
+    \Drupal::logger('gigya_user_deletion')->warning('Gigya cron installed but not enabled. No action taken.');
+  }
+}
+
+/**
+ * Implement hook_mail()
+ *
+ * {@inheritdoc}
+ */
+function gigya_user_deletion_mail($key, &$message, $params) {
+  $options = [
+    'langcode' => $message['langcode'],
+  ];
+
+  $message['from'] = \Drupal::config('system.site')->get('mail');
+  $message['subject'] = t($params['subject'], [], $options);
+  $message['body'][] = $params['message'];
+}
diff --git a/gigya_user_deletion/src/Form/GigyaCronForm.php b/gigya_user_deletion/src/Form/GigyaCronForm.php
index ce0dd33..a69259d 100755
--- a/gigya_user_deletion/src/Form/GigyaCronForm.php
+++ b/gigya_user_deletion/src/Form/GigyaCronForm.php
@@ -1,308 +1,308 @@
 <?php
-	/**
-	 * @file
-	 * Contains \Drupal\gigya_user_deletion\Form\GigyaCronForm.
-	 */
-
-	namespace Drupal\gigya_user_deletion\Form;
-
-	use Drupal\Core\Form\ConfigFormBase;
-	use Drupal\Core\Form\FormStateInterface;
-	use Drupal\gigya\Helper\GigyaHelper;
-	use Drupal\gigya\Helper\GigyaHelperInterface;
-	use Aws\S3\S3Client;
-	use Aws\S3\Exception\S3Exception;
-
-	class GigyaCronForm extends ConfigFormBase {
-		/**
-		 * @var bool | GigyaHelper
-		 */
-		public $helper = false;
-
-		/**
-		 * @param FormStateInterface $form_state
-		 * @param string             $prop_name
-		 *
-		 * @return string
-		 */
-		private function getValue($form_state, $prop_name) {
-			return trim($form_state->getValue($prop_name));
-		}
-
-		/**
-		 * Gets the configuration names that will be editable.
-		 *
-		 * @return array
-		 *   An array of configuration object names that are editable if called in
-		 *   conjunction with the trait's config() method.
-		 */
-		protected function getEditableConfigNames() {
-			return [
-				'gigya_user_deletion.job',
-			];
-		}
-
-		/**
-		 * @param array                                $form
-		 * @param \Drupal\Core\Form\FormStateInterface $form_state
-		 * @param GigyaHelperInterface                 $helper
-		 *
-		 * @return array
-		 */
-		public function buildForm(array $form, FormStateInterface $form_state, GigyaHelperInterface $helper = null) {
-			if ($helper == null)
-			{
-				$this->helper = new GigyaHelper();
-			}
-			else
-			{
-				$this->helper = $helper;
-			}
-
-			/* Show error on missing dependencies */
-			if (!$this->helper->checkEncryptKey())
-				drupal_set_message($this->t('Cannot read encrypt key'), 'error');
-			if (!class_exists('Aws\\S3\\S3Client'))
-				drupal_set_message($this->t('This module requires Amazon\'s PHP SDK'), 'error');
-			if (!class_exists('Gigya\\CmsStarterKit\\GigyaApiHelper'))
-				drupal_set_message($this->t('This module requires Gigya\'s PHP CMS Kit'), 'error');
-
-			$form = parent::buildForm($form, $form_state);
-			$config = $this->config('gigya_user_deletion.job');
-
-			$form['enableJobLabel'] = array(
-				'#type'       => 'label',
-				'#title'      => $this->t('Enable'),
-				"#attributes" => array(
-					'class' => 'gigya-label-cb',
-				),
-			);
-			$form['enableJob'] = array(
-				'#type'          => 'checkbox',
-				'#default_value' => $config->get('gigya_user_deletion.enableJob'),
-			);
-
-			/* Deletion type – soft/hard */
-			$form['deletionType'] = array(
-				'#type'          => 'select',
-				'#title'         => $this->t('Deletion type'),
-				'#options'       => array(
-					'soft' => $this->t('Tag deleted user'),
-					'hard' => $this->t('Full user deletion'),
-				),
-				'#default_value' => $config->get('gigya_user_deletion.deletionType'),
-			);
-
-			/* Job frequency */
-			$form['jobFrequency'] = array(
-				'#type'  => 'textfield',
-				'#title' => $this->t('Job frequency (minutes)'),
-			);
-			$jobFrequency = $config->get('gigya_user_deletion.jobFrequency') / 60;
-			if ($jobFrequency == 0)
-				$form['jobFrequency']['#default_value'] = '';
-			else
-				$form['jobFrequency']['#default_value'] = $jobFrequency;
-
-			/* Email on success */
-			$form['emailOnSuccess'] = array(
-				'#type'          => 'textfield',
-				'#title'         => $this->t('Email on success'),
-				'#description'   => $this->t('A comma-separated list of emails that will be notified when the job completes successfully'),
-				'#default_value' => $config->get('gigya_user_deletion.emailOnSuccess'),
-			);
-
-			/* Email on failure */
-			$form['emailOnFailure'] = array(
-				'#type'          => 'textfield',
-				'#title'         => $this->t('Email on failure'),
-				'#description'   => $this->t('A comma-separated list of emails that will be notified when the job fails or completes with errors'),
-				'#default_value' => $config->get('gigya_user_deletion.emailOnFailure'),
-			);
-
-			/* S3 Storage Details */
-
-			/* Label */
-			$form['storage'] = array(
-				'#type'       => 'label',
-				'#title'      => $this->t('Amazon S3 settings'),
-				'#attributes' => array(
-					'class' => 'gigya-label-custom',
-				),
-			);
-
-			/* Bucket name */
-			$form['storageDetails']['bucketName'] = array(
-				'#type'          => 'textfield',
-				'#title'         => $this->t('Bucket name'),
-				'#default_value' => $config->get('gigya_user_deletion.storageDetails.bucketName'),
-			);
-
-			/* Access key */
-			$form['storageDetails']['accessKey'] = array(
-				'#type'          => 'textfield',
-				'#title'         => $this->t('Access key'),
-				'#default_value' => $config->get('gigya_user_deletion.storageDetails.accessKey'),
-			);
-
-			/* Secret key */
-			$key = $config->get('gigya_user_deletion.storageDetails.secretKey');
-			$access_key = "";
-			if (!empty($key))
-				$access_key = $this->helper->decrypt($key);
-			$form['storageDetails']['secretKey'] = array(
-				'#type'       => 'textfield',
-				'#title'      => $this->t('Secret key'),
-				'#attributes' => array(
-					'autocomplete' => 'off',
-				),
-			);
-			if (!empty($access_key))
-			{
-				$form['storageDetails']['secretKey']['#default_value'] = "*********";
-				$form['storageDetails']['secretKey']['#description'] = $this->t(
-					"Current key first letters are @accessKey", array('@accessKey' => substr($access_key, 0, 2) . "******" . substr($access_key, strlen($access_key) - 2, 2))
-				);
-
-			}
-
-			/* Object key prefix (directory) */
-			$form['storageDetails']['objectKeyPrefix'] = array(
-				'#type'          => 'textfield',
-				'#title'         => $this->t('Object key prefix'),
-				'#default_value' => $config->get('gigya_user_deletion.storageDetails.objectKeyPrefix'),
-			);
-
-			/* .S3 Storage Details */
-
-			return $form;
-		}
-
-		/**
-		 * Returns a unique string identifying the form.
-		 *
-		 * @return string
-		 *   The unique string identifying the form.
-		 */
-		public function getFormId() {
-			return 'gigya_job_params';
-		}
-
-		public function validateForm(array &$form, FormStateInterface $form_state) {
-			/* Check if the form has errors, if true we do not need to validate the user input because it has errors already. */
-			parent::validateForm($form, $form_state);
-			if ($form_state->getErrors())
-				return;
-
-			$jobRequiredFields = [
-				'jobFrequency',
-				'storageDetails.bucketName',
-				'storageDetails.accessKey',
-				'storageDetails.secretKey',
-			];
-
-			/* If $_enableJob is true verify all required fields with value */
-			$_enableJob = $this->getValue($form_state, 'enableJob');
-
-			if ($_enableJob)
-			{
-				if (!class_exists('Gigya\\CmsStarterKit\\GigyaApiHelper'))
-				{
-					$msg = 'This module requires the PHP CMS Kit package. Please install it before enabling this module.';
-					\Drupal::logger('gigya_user_deletion')->error($msg);
-					$form_state->setErrorByName('storageDetails.secretKey', $this->t($msg));
-
-					return;
-				}
-
-				$helper = new GigyaHelper();
-				if (!$helper->checkEncryptKey())
-					drupal_set_message($this->t('Cannot read encrypt key'), 'error');
-
-				foreach ($jobRequiredFields as $field)
-				{
-					if (strpos($field, 'storageDetails') !== false)
-					{
-						$num = strlen($field) - strlen('storageDetails') - 1;
-						$field = substr($field, 0 - $num);
-						$fieldValue = $form['storageDetails'][$field]['#value'];
-					}
-					else
-					{
-						$fieldValue = $this->getValue($form_state, $field);
-					}
-
-					if (empty($fieldValue))
-					{
-						$form_state->setErrorByName($field, $this->t($field . " is a required field if the job enabled."));
-						break;
-					}
-				}
-
-				$bucketName = $this->getValue($form_state, 'bucketName');
-				$accessKey = $this->getValue($form_state, 'accessKey');
-				$secretKey = $this->getValue($form_state, 'secretKey');
-
-				/* If secret encrypt -> decrypt it */
-				if (empty($secretKey) or $secretKey === "*********")
-				{
-					$secretKeyEnc = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails.secretKey');
-					$secretKey = $helper->decrypt($secretKeyEnc);
-				}
-
-				if (class_exists('Aws\\S3\\S3Client'))
-				{
-					$s3Client = S3Client::factory(array(
-						                              'key'    => $accessKey,
-						                              'secret' => $secretKey,
-					                              ));
-
-					try
-					{
-						$s3Client->GetBucketLocation(array('Bucket' => $bucketName,));
-					}
-					catch (S3Exception $e)
-					{
-						\Drupal::logger('gigya_user_deletion')->error("Failed to connect to S3 server (form) - " . $e->getMessage());
-						$form_state->setErrorByName('storageDetails.secretKey', $this->t("Failed connecting to S3 server with error: " . $e->getMessage()));
-					}
-				}
-				else
-				{
-					$msg = 'This module requires the Amazon SDK for PHP. Please install the SDK before enabling the module.';
-					\Drupal::logger('gigya_user_deletion')->error($msg);
-					drupal_set_message($this->t($msg), 'error');
-				}
-			}
-		}
-
-		public function submitForm(array &$form, FormStateInterface $form_state) {
-			$config = $this->config('gigya_user_deletion.job');
-			$config->set('gigya_user_deletion.enableJob', $this->getValue($form_state, 'enableJob'));
-			$config->set('gigya_user_deletion.deletionType', $this->getValue($form_state, 'deletionType'));
-
-			$jobFrequency = $this->getValue($form_state, 'jobFrequency') * 60;
-
-			if ($jobFrequency == 0)
-				$config->set('gigya_user_deletion.jobFrequency', '');
-			else
-				$config->set('gigya_user_deletion.jobFrequency', $jobFrequency);
-
-			$config->set('gigya_user_deletion.emailOnSuccess', $this->getValue($form_state, 'emailOnSuccess'));
-			$config->set('gigya_user_deletion.emailOnFailure', $this->getValue($form_state, 'emailOnFailure'));
-			$config->set('gigya_user_deletion.storageDetails.bucketName', $this->getValue($form_state, 'bucketName'));
-			$config->set('gigya_user_deletion.storageDetails.accessKey', $this->getValue($form_state, 'accessKey'));
-
-			/* Encrypt storageDetails.secret */
-			$temp_access_key = $this->getValue($form_state, 'secretKey');
-			if (!empty($temp_access_key) && $temp_access_key !== "*********")
-			{
-				$enc = $this->helper->enc($temp_access_key);
-				$config->set('gigya_user_deletion.storageDetails.secretKey', $enc);
-			}
-			$config->set('gigya_user_deletion.storageDetails.objectKeyPrefix', $this->getValue($form_state, 'objectKeyPrefix'));
-			$config->save();
-			parent::submitForm($form, $form_state);
-		}
-	}
 
+namespace Drupal\gigya_user_deletion\Form;
+
+use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\gigya\Helper\GigyaHelper;
+use Drupal\gigya\Helper\GigyaHelperInterface;
+use Aws\S3\S3Client;
+use Aws\S3\Exception\S3Exception;
+
+/**
+ *
+ */
+class GigyaCronForm extends ConfigFormBase {
+  /**
+   * @var bool|GigyaHelper
+   */
+  public $helper = FALSE;
+
+  /**
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   * @param string $prop_name
+   *
+   * @return string
+   */
+  private function getValue($form_state, $prop_name) {
+    return trim($form_state->getValue($prop_name));
+  }
+
+  /**
+   * Gets the configuration names that will be editable.
+   *
+   * @return array
+   *   An array of configuration object names that are editable if called in
+   *   conjunction with the trait's config() method.
+   */
+  protected function getEditableConfigNames() {
+    return [
+      'gigya_user_deletion.job',
+    ];
+  }
+
+  /**
+   * @param array $form
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   * @param \Drupal\gigya\Helper\GigyaHelperInterface $helper
+   *
+   * @return array
+   */
+  public function buildForm(array $form, FormStateInterface $form_state, GigyaHelperInterface $helper = NULL) {
+    if ($helper == NULL) {
+      $this->helper = new GigyaHelper();
+    }
+    else {
+      $this->helper = $helper;
+    }
+
+    /* Show error on missing dependencies */
+    if (!$this->helper->checkEncryptKey()) {
+      drupal_set_message($this->t('Cannot read encrypt key'), 'error');
+    }
+    if (!class_exists('Aws\\S3\\S3Client')) {
+      drupal_set_message($this->t('This module requires Amazon\'s PHP SDK'), 'error');
+    }
+    if (!class_exists('Gigya\\CmsStarterKit\\GigyaApiHelper')) {
+      drupal_set_message($this->t('This module requires Gigya\'s PHP CMS Kit'), 'error');
+    }
+
+    $form = parent::buildForm($form, $form_state);
+    $config = $this->config('gigya_user_deletion.job');
+
+    $form['enableJobLabel'] = [
+      '#type'       => 'label',
+      '#title'      => $this->t('Enable'),
+      "#attributes" => [
+        'class' => 'gigya-label-cb',
+      ],
+    ];
+    $form['enableJob'] = [
+      '#type'          => 'checkbox',
+      '#default_value' => $config->get('gigya_user_deletion.enableJob'),
+    ];
+
+    /* Deletion type – soft/hard */
+    $form['deletionType'] = [
+      '#type'          => 'select',
+      '#title'         => $this->t('Deletion type'),
+      '#options'       => [
+        'soft' => $this->t('Tag deleted user'),
+        'hard' => $this->t('Full user deletion'),
+      ],
+      '#default_value' => $config->get('gigya_user_deletion.deletionType'),
+    ];
+
+    /* Job frequency */
+    $form['jobFrequency'] = [
+      '#type'  => 'textfield',
+      '#title' => $this->t('Job frequency (minutes)'),
+    ];
+    $jobFrequency = $config->get('gigya_user_deletion.jobFrequency') / 60;
+    if ($jobFrequency == 0) {
+      $form['jobFrequency']['#default_value'] = '';
+    }
+    else {
+      $form['jobFrequency']['#default_value'] = $jobFrequency;
+    }
+
+    /* Email on success */
+    $form['emailOnSuccess'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Email on success'),
+      '#description'   => $this->t('A comma-separated list of emails that will be notified when the job completes successfully'),
+      '#default_value' => $config->get('gigya_user_deletion.emailOnSuccess'),
+    ];
+
+    /* Email on failure */
+    $form['emailOnFailure'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Email on failure'),
+      '#description'   => $this->t('A comma-separated list of emails that will be notified when the job fails or completes with errors'),
+      '#default_value' => $config->get('gigya_user_deletion.emailOnFailure'),
+    ];
+
+    /* S3 Storage Details */
+
+    /* Label */
+    $form['storage'] = [
+      '#type'       => 'label',
+      '#title'      => $this->t('Amazon S3 settings'),
+      '#attributes' => [
+        'class' => 'gigya-label-custom',
+      ],
+    ];
+
+    /* Bucket name */
+    $form['storageDetails']['bucketName'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Bucket name'),
+      '#default_value' => $config->get('gigya_user_deletion.storageDetails.bucketName'),
+    ];
+
+    /* Access key */
+    $form['storageDetails']['accessKey'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Access key'),
+      '#default_value' => $config->get('gigya_user_deletion.storageDetails.accessKey'),
+    ];
+
+    /* Secret key */
+    $key = $config->get('gigya_user_deletion.storageDetails.secretKey');
+    $access_key = "";
+    if (!empty($key)) {
+      $access_key = $this->helper->decrypt($key);
+    }
+    $form['storageDetails']['secretKey'] = [
+      '#type'       => 'textfield',
+      '#title'      => $this->t('Secret key'),
+      '#attributes' => [
+        'autocomplete' => 'off',
+      ],
+    ];
+    if (!empty($access_key)) {
+      $form['storageDetails']['secretKey']['#default_value'] = "*********";
+      $form['storageDetails']['secretKey']['#description'] = $this->t(
+      "Current key first letters are @accessKey", ['@accessKey' => substr($access_key, 0, 2) . "******" . substr($access_key, strlen($access_key) - 2, 2)]
+      );
+
+    }
+
+    /* Object key prefix (directory) */
+    $form['storageDetails']['objectKeyPrefix'] = [
+      '#type'          => 'textfield',
+      '#title'         => $this->t('Object key prefix'),
+      '#default_value' => $config->get('gigya_user_deletion.storageDetails.objectKeyPrefix'),
+    ];
+
+    /* .S3 Storage Details */
+
+    return $form;
+  }
+
+  /**
+   * Returns a unique string identifying the form.
+   *
+   * @return string
+   *   The unique string identifying the form.
+   */
+  public function getFormId() {
+    return 'gigya_job_params';
+  }
+
+  /**
+   *
+   */
+  public function validateForm(array &$form, FormStateInterface $form_state) {
+    /* Check if the form has errors, if true we do not need to validate the user input because it has errors already. */
+    parent::validateForm($form, $form_state);
+    if ($form_state->getErrors()) {
+      return;
+    }
+
+    $jobRequiredFields = [
+      'jobFrequency',
+      'storageDetails.bucketName',
+      'storageDetails.accessKey',
+      'storageDetails.secretKey',
+    ];
+
+    /* If $_enableJob is true verify all required fields with value */
+    $_enableJob = $this->getValue($form_state, 'enableJob');
+
+    if ($_enableJob) {
+      if (!class_exists('Gigya\\CmsStarterKit\\GigyaApiHelper')) {
+        $msg = 'This module requires the PHP CMS Kit package. Please install it before enabling this module.';
+        \Drupal::logger('gigya_user_deletion')->error($msg);
+        $form_state->setErrorByName('storageDetails.secretKey', $this->t($msg));
+
+        return;
+      }
+
+      $helper = new GigyaHelper();
+      if (!$helper->checkEncryptKey()) {
+        drupal_set_message($this->t('Cannot read encrypt key'), 'error');
+      }
+
+      foreach ($jobRequiredFields as $field) {
+        if (strpos($field, 'storageDetails') !== FALSE) {
+          $num = strlen($field) - strlen('storageDetails') - 1;
+          $field = substr($field, 0 - $num);
+          $fieldValue = $form['storageDetails'][$field]['#value'];
+        }
+        else {
+          $fieldValue = $this->getValue($form_state, $field);
+        }
+
+        if (empty($fieldValue)) {
+          $form_state->setErrorByName($field, $this->t($field . " is a required field if the job enabled."));
+          break;
+        }
+      }
+
+      $bucketName = $this->getValue($form_state, 'bucketName');
+      $accessKey = $this->getValue($form_state, 'accessKey');
+      $secretKey = $this->getValue($form_state, 'secretKey');
+
+      /* If secret encrypt -> decrypt it */
+      if (empty($secretKey) or $secretKey === "*********") {
+        $secretKeyEnc = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails.secretKey');
+        $secretKey = $helper->decrypt($secretKeyEnc);
+      }
+
+      if (class_exists('Aws\\S3\\S3Client')) {
+        $s3Client = S3Client::factory([
+          'key'    => $accessKey,
+          'secret' => $secretKey,
+        ]);
+
+        try {
+          $s3Client->GetBucketLocation(['Bucket' => $bucketName]);
+        }
+        catch (S3Exception $e) {
+          \Drupal::logger('gigya_user_deletion')->error("Failed to connect to S3 server (form) - " . $e->getMessage());
+          $form_state->setErrorByName('storageDetails.secretKey', $this->t("Failed connecting to S3 server with error: " . $e->getMessage()));
+        }
+      }
+      else {
+        $msg = 'This module requires the Amazon SDK for PHP. Please install the SDK before enabling the module.';
+        \Drupal::logger('gigya_user_deletion')->error($msg);
+        drupal_set_message($this->t($msg), 'error');
+      }
+    }
+  }
+
+  /**
+   *
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $config = $this->config('gigya_user_deletion.job');
+    $config->set('gigya_user_deletion.enableJob', $this->getValue($form_state, 'enableJob'));
+    $config->set('gigya_user_deletion.deletionType', $this->getValue($form_state, 'deletionType'));
+
+    $jobFrequency = $this->getValue($form_state, 'jobFrequency') * 60;
+
+    if ($jobFrequency == 0) {
+      $config->set('gigya_user_deletion.jobFrequency', '');
+    }
+    else {
+      $config->set('gigya_user_deletion.jobFrequency', $jobFrequency);
+    }
+
+    $config->set('gigya_user_deletion.emailOnSuccess', $this->getValue($form_state, 'emailOnSuccess'));
+    $config->set('gigya_user_deletion.emailOnFailure', $this->getValue($form_state, 'emailOnFailure'));
+    $config->set('gigya_user_deletion.storageDetails.bucketName', $this->getValue($form_state, 'bucketName'));
+    $config->set('gigya_user_deletion.storageDetails.accessKey', $this->getValue($form_state, 'accessKey'));
+
+    /* Encrypt storageDetails.secret */
+    $temp_access_key = $this->getValue($form_state, 'secretKey');
+    if (!empty($temp_access_key) && $temp_access_key !== "*********") {
+      $enc = $this->helper->enc($temp_access_key);
+      $config->set('gigya_user_deletion.storageDetails.secretKey', $enc);
+    }
+    $config->set('gigya_user_deletion.storageDetails.objectKeyPrefix', $this->getValue($form_state, 'objectKeyPrefix'));
+    $config->save();
+    parent::submitForm($form, $form_state);
+  }
+
+}
diff --git a/gigya_user_deletion/src/Helper/GigyaUserDeletionHelper.php b/gigya_user_deletion/src/Helper/GigyaUserDeletionHelper.php
index f62b24a..a0a3ee6 100755
--- a/gigya_user_deletion/src/Helper/GigyaUserDeletionHelper.php
+++ b/gigya_user_deletion/src/Helper/GigyaUserDeletionHelper.php
@@ -1,228 +1,223 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: Yan Nasonov
-	 * Date: 23/11/2017
-	 * Time: 11:56
-	 */
 
-	namespace Drupal\gigya_user_deletion\Helper;
+namespace Drupal\gigya_user_deletion\Helper;
 
-	use Aws\S3\S3Client;
-	use Aws\S3\Exception\S3Exception;
-	use Drupal\gigya\Helper\GigyaHelper;
+use Aws\S3\S3Client;
+use Aws\S3\Exception\S3Exception;
+use Drupal\gigya\Helper\GigyaHelper;
 
-	class GigyaUserDeletionHelper implements GigyaUserDeletionHelperInterface
-	{
-		private $helper;
+/**
+ *
+ */
+class GigyaUserDeletionHelper implements GigyaUserDeletionHelperInterface {
+  private $helper;
 
-		public function __construct($helper = null) {
-			if ($helper)
-				$this->helper = $helper;
-		}
+  /**
+   *
+   */
+  public function __construct($helper = NULL) {
+    if ($helper) {
+      $this->helper = $helper;
+    }
+  }
 
-		/**
-		 * Function connect to S3 and retrieves all files in bucket (name only)
-		 */
-		public function getFileList() {
-			try
-			{
-				$secretKey = '';
-				$storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
-				if ($this->helper)
-					$helper = $this->helper;
-				else
-					$helper = new GigyaHelper();
-				$bucketName = $storageDetails['bucketName'];
-				$accessKey = $storageDetails['accessKey'];
-				$secretKeyEnc = $storageDetails['secretKey'];
-				if (!empty($secretKeyEnc))
-				{
-					$secretKey = $helper->decrypt($secretKeyEnc);
-				}
-				$objectKeyPrefix = $storageDetails['objectKeyPrefix'] . "/";
-				$region = $this->getRegion();
-				$s3Client = S3Client::factory(array(
-												  'key' => $accessKey,
-												  'secret' => $secretKey,
-												  'signature' => 'v4',
-												  'region' => $region,
-											  ));
+  /**
+   * Function connect to S3 and retrieves all files in bucket (name only)
+   */
+  public function getFileList() {
+    try {
+      $secretKey = '';
+      $storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
+      if ($this->helper) {
+        $helper = $this->helper;
+      }
+      else {
+        $helper = new GigyaHelper();
+      }
+      $bucketName = $storageDetails['bucketName'];
+      $accessKey = $storageDetails['accessKey'];
+      $secretKeyEnc = $storageDetails['secretKey'];
+      if (!empty($secretKeyEnc)) {
+        $secretKey = $helper->decrypt($secretKeyEnc);
+      }
+      $objectKeyPrefix = $storageDetails['objectKeyPrefix'] . "/";
+      $region = $this->getRegion();
+      $s3Client = S3Client::factory([
+        'key' => $accessKey,
+        'secret' => $secretKey,
+        'signature' => 'v4',
+        'region' => $region,
+      ]);
 
-				/* Max of 15 files */
-				$response = $s3Client->listObjects(array(
-													   'Bucket' => $bucketName,
-													   'MaxKeys' => 15,
-													   'Prefix' => $objectKeyPrefix)
-				);
-				$files = $response->getPath('Contents');
-				return $files;
-			}
-			catch (S3Exception $e)
-			{
-				\Drupal::logger('gigya_user_deletion')->error("Failed to get files list from S3 server. Error: " . $e->getMessage());
-				return false;
-			}
-			catch (\Exception $e)
-			{
-				\Drupal::logger('gigya_user_deletion')->error("Missing required parameter. Error code: " . $e->getCode() . ". Message: " . $e->getMessage());
-				return false;
-			}
-		}
+      /* Max of 15 files */
+      $response = $s3Client->listObjects([
+        'Bucket' => $bucketName,
+        'MaxKeys' => 15,
+        'Prefix' => $objectKeyPrefix,
+      ]
+      );
+      $files = $response->getPath('Contents');
+      return $files;
+    }
+    catch (S3Exception $e) {
+      \Drupal::logger('gigya_user_deletion')->error("Failed to get files list from S3 server. Error: " . $e->getMessage());
+      return FALSE;
+    }
+    catch (\Exception $e) {
+      \Drupal::logger('gigya_user_deletion')->error("Missing required parameter. Error code: " . $e->getCode() . ". Message: " . $e->getMessage());
+      return FALSE;
+    }
+  }
 
-		/**
-		 * Function return file content
-		 *
-		 * @param    string $file_name File name
-		 *
-		 * @return    bool                File content
-		 */
-		public function loadFileFromServer($file_name) {
-			/* Get S3 connection details from DB */
-			$secretKey = '';
-			$storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
-			if ($this->helper)
-				$helper = $this->helper;
-			else
-				$helper = new GigyaHelper();
-			$bucketName = $storageDetails['bucketName'];
-			$accessKey = $storageDetails['accessKey'];
-			$secretKeyEnc = $storageDetails['secretKey'];
-			if (!empty($secretKeyEnc))
-			{
-				$secretKey = $helper->decrypt($secretKeyEnc);
-			}
-			$region = $this->getRegion();
-			$s3Client = S3Client::factory(array(
-											  'key' => $accessKey,
-											  'secret' => $secretKey,
-											  'region' => $region,
-											  'signature' => 'v4',
-										  ));
+  /**
+   * Function return file content.
+   *
+   * @param string $file_name
+   *   File name.
+   *
+   * @return bool                File content
+   */
+  public function loadFileFromServer($file_name) {
+    /* Get S3 connection details from DB */
+    $secretKey = '';
+    $storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
+    if ($this->helper) {
+      $helper = $this->helper;
+    }
+    else {
+      $helper = new GigyaHelper();
+    }
+    $bucketName = $storageDetails['bucketName'];
+    $accessKey = $storageDetails['accessKey'];
+    $secretKeyEnc = $storageDetails['secretKey'];
+    if (!empty($secretKeyEnc)) {
+      $secretKey = $helper->decrypt($secretKeyEnc);
+    }
+    $region = $this->getRegion();
+    $s3Client = S3Client::factory([
+      'key' => $accessKey,
+      'secret' => $secretKey,
+      'region' => $region,
+      'signature' => 'v4',
+    ]);
 
-			/* Read file from S3 */
-			try
-			{
-				$result = $s3Client->getObject(array(
-												   'Bucket' => $bucketName,
-												   'Key' => $file_name,
-											   ));
-				$body = $result->get('Body');
-				$body->rewind();
-				$content = $body->read($result['ContentLength']);
-				return $content;
-			}
-			catch (S3Exception $e)
-			{
-				\Drupal::logger('gigya_user_deletion')->error("Failed to get file from S3 server - " . $e->getMessage());
-				return false;
-			}
-		}
+    /* Read file from S3 */
+    try {
+      $result = $s3Client->getObject([
+        'Bucket' => $bucketName,
+        'Key' => $file_name,
+      ]);
+      $body = $result->get('Body');
+      $body->rewind();
+      $content = $body->read($result['ContentLength']);
+      return $content;
+    }
+    catch (S3Exception $e) {
+      \Drupal::logger('gigya_user_deletion')->error("Failed to get file from S3 server - " . $e->getMessage());
+      return FALSE;
+    }
+  }
 
-		/**
-		 * Parse file content to array of Gigya UIDs
-		 *
-		 * @param    $fileName
-		 *
-		 * @return array | null
-		 */
-		public function getUsers($fileName) {
-			$file = $this->loadFileFromServer($fileName);
-			if ($file !== null)
-			{
-				$array = array_map('str_getcsv', explode("\n", $file));
-				array_walk($array, function(&$a) use ($array) {
-					$a = array_combine($array[0], $a);
-				});
-				array_shift($array); /* Remove column header */
-				return $array;
-			}
-			return null;
-		}
+  /**
+   * Parse file content to array of Gigya UIDs.
+   *
+   * @param $fileName
+   *
+   * @return array | null
+   */
+  public function getUsers($fileName) {
+    $file = $this->loadFileFromServer($fileName);
+    if ($file !== NULL) {
+      $array = array_map('str_getcsv', explode("\n", $file));
+      array_walk($array, function (&$a) use ($array) {
+         $a = array_combine($array[0], $a);
+      });
+      array_shift($array); /* Remove column header */
+      return $array;
+    }
+    return NULL;
+  }
 
-		/**
-		 * Send email
-		 *
-		 * @param    $subject
-		 * @param    $body
-		 * @param    $to
-		 *
-		 * @return bool
-		 */
-		public function sendEmail($subject, $body, $to) {
-			$mailManager = \Drupal::service('plugin.manager.mail');
-			$module = 'gigya_user_deletion';
-			$params['from'] = 'Gigya IdentitySync';
-			$params['subject'] = $subject;
-			$params['message'] = $body;
-			$key = 'job_email';
+  /**
+   * Send email.
+   *
+   * @param $subject
+   * @param $body
+   * @param $to
+   *
+   * @return bool
+   */
+  public function sendEmail($subject, $body, $to) {
+    $mailManager = \Drupal::service('plugin.manager.mail');
+    $module = 'gigya_user_deletion';
+    $params['from'] = 'Gigya IdentitySync';
+    $params['subject'] = $subject;
+    $params['message'] = $body;
+    $key = 'job_email';
 
-			try /* For testability */
-			{
-				$langcode = \Drupal::currentUser()->getPreferredLangcode();
-			}
-			catch (\Exception $e)
-			{
-				$langcode = 'en';
-			}
-			if (!isset($langcode))
-				$langcode = 'en';
+    try /* For testability */
+    {
+      $langcode = \Drupal::currentUser()->getPreferredLangcode();
+    }
+    catch (\Exception $e) {
+      $langcode = 'en';
+    }
+    if (!isset($langcode)) {
+      $langcode = 'en';
+    }
 
-			try
-			{
-				foreach (explode(',', $to) as $email)
-				{
-					$result = $mailManager->mail($module, $key, trim($email), $langcode, $params, null, $send = true);
-					if (!$result)
-					{
-						\Drupal::logger('gigya_user_deletion')->error('Failed to send email to ' . $email);
-					}
-				}
-			}
-			catch (\Exception $e)
-			{
-				\Drupal::logger('gigya_user_deletion')->error('Failed to send emails - ' . $e->getMessage());
-				return false;
-			}
-			return true;
-		}
+    try {
+      foreach (explode(',', $to) as $email) {
+        $result = $mailManager->mail($module, $key, trim($email), $langcode, $params, NULL, $send = TRUE);
+        if (!$result) {
+          \Drupal::logger('gigya_user_deletion')->error('Failed to send email to ' . $email);
+        }
+      }
+    }
+    catch (\Exception $e) {
+      \Drupal::logger('gigya_user_deletion')->error('Failed to send emails - ' . $e->getMessage());
+      return FALSE;
+    }
+    return TRUE;
+  }
 
-		/**
-		 * Get S3 Region
-		 *
-		 * @param null | GigyaHelper $helper Dependency injection for testability
-		 *
-		 * @return string | false
-		 */
-		public function getRegion() {
-			//Get S3 connection details from DB
-			$secretKey = "";
-			$storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
-			if ($this->helper)
-				$helper = $this->helper;
-			else
-				$helper = new GigyaHelper();
-			$bucketName = $storageDetails['bucketName'];
-			$accessKey = $storageDetails['accessKey'];
-			$secretKeyEnc = $storageDetails['secretKey'];
-			//decrypt S3 secret
-			if (!empty($secretKeyEnc))
-			{
-				$secretKey = $helper->decrypt($secretKeyEnc);
-			}
-			$s3Client = S3Client::factory(array(
-											  'key' => $accessKey,
-											  'secret' => $secretKey,
-										  ));
-			try
-			{
-				$response = $s3Client->GetBucketLocation(array('Bucket' => $bucketName,));
-				return $response->get('Location');
-			}
-			catch (S3Exception $e)
-			{
-				\Drupal::logger('gigya_user_deletion')->error("Failed to get region from S3 server - " . $e->getMessage());
-				return false;
-			}
-		}
-	}
\ No newline at end of file
+  /**
+   * Get S3 Region.
+   *
+   * @param null | GigyaHelper $helper
+   *   Dependency injection for testability.
+   *
+   * @return string | false
+   */
+  public function getRegion() {
+    // Get S3 connection details from DB.
+    $secretKey = "";
+    $storageDetails = \Drupal::config('gigya_user_deletion.job')->get('gigya_user_deletion.storageDetails');
+    if ($this->helper) {
+      $helper = $this->helper;
+    }
+    else {
+      $helper = new GigyaHelper();
+    }
+    $bucketName = $storageDetails['bucketName'];
+    $accessKey = $storageDetails['accessKey'];
+    $secretKeyEnc = $storageDetails['secretKey'];
+    // Decrypt S3 secret.
+    if (!empty($secretKeyEnc)) {
+      $secretKey = $helper->decrypt($secretKeyEnc);
+    }
+    $s3Client = S3Client::factory([
+      'key' => $accessKey,
+      'secret' => $secretKey,
+    ]);
+    try {
+      $response = $s3Client->GetBucketLocation(['Bucket' => $bucketName]);
+      return $response->get('Location');
+    }
+    catch (S3Exception $e) {
+      \Drupal::logger('gigya_user_deletion')->error("Failed to get region from S3 server - " . $e->getMessage());
+      return FALSE;
+    }
+  }
+
+}
diff --git a/gigya_user_deletion/src/Helper/GigyaUserDeletionHelperInterface.php b/gigya_user_deletion/src/Helper/GigyaUserDeletionHelperInterface.php
index 70b875e..4e0c99a 100755
--- a/gigya_user_deletion/src/Helper/GigyaUserDeletionHelperInterface.php
+++ b/gigya_user_deletion/src/Helper/GigyaUserDeletionHelperInterface.php
@@ -1,25 +1,35 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: Yan Nasonov
-	 * Date: 23/11/2017
-	 * Time: 11:50
-	 *
-	 * @file
-	 * Contains \Drupal\gigya_user_deletion\Helper\GigyaUserDeletionHelperInterface.
-	 */
 
-	namespace Drupal\gigya_user_deletion\Helper;
+namespace Drupal\gigya_user_deletion\Helper;
 
-	interface GigyaUserDeletionHelperInterface
-	{
-		public function getFileList();
+/**
+ *
+ */
+interface GigyaUserDeletionHelperInterface {
 
-		public function loadFileFromServer($file_name);
+  /**
+   *
+   */
+  public function getFileList();
 
-		public function getUsers($fileName);
+  /**
+   *
+   */
+  public function loadFileFromServer($file_name);
 
-		public function sendEmail($subject, $body, $to);
+  /**
+   *
+   */
+  public function getUsers($fileName);
 
-		public function getRegion();
-	}
\ No newline at end of file
+  /**
+   *
+   */
+  public function sendEmail($subject, $body, $to);
+
+  /**
+   *
+   */
+  public function getRegion();
+
+}
diff --git a/gigya_user_deletion/tests/src/Functional/GigyaUserDeletionTest.php b/gigya_user_deletion/tests/src/Functional/GigyaUserDeletionTest.php
index 19ee135..eb8d602 100755
--- a/gigya_user_deletion/tests/src/Functional/GigyaUserDeletionTest.php
+++ b/gigya_user_deletion/tests/src/Functional/GigyaUserDeletionTest.php
@@ -1,83 +1,91 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: Yan Nasonov
-	 * Date: 21/11/2017
-	 * Time: 12:02
-	 */
 
-	use Drupal\Tests\BrowserTestBase;
-	use Drupal\Core\Form\FormState;
+    /**
+     * Created by PhpStorm.
+     * User: Yan Nasonov
+     * Date: 21/11/2017
+     * Time: 12:02.
+     */
 
-	class GigyaUserDeletionTest extends BrowserTestBase
-	{
-		/**
-		 * Modules to enable on setUp()
-		 *
-		 * @var array
-		 */
-		protected static $modules = ['gigya', 'gigya_raas', 'gigya_user_deletion'];
+    use Drupal\Tests\BrowserTestBase;
+use Drupal\Core\Form\FormState;
 
-		/**
-		 * @var    \Drupal\user\UserInterface
-		 */
-		protected $gigyaAdmin;
+/**
+ *
+ */
+class GigyaUserDeletionTest extends BrowserTestBase {
+  /**
+   * Modules to enable on setUp()
+   *
+   * @var array
+   */
+  protected static $modules = ['gigya', 'gigya_raas', 'gigya_user_deletion'];
 
-		/**
-		 * {@inheritdoc}
-		 */
-		public function setUp() {
-			parent::setUp();
+  /**
+   * @var    \Drupal\user\UserInterface
+   */
+  protected $gigyaAdmin;
 
-			$this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
-		}
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
 
-		public function testConfigPageUI() {
-			/* Checks that admin config page is not accessible without logging in */
-			$this->drupalGet('admin/config/gigya/cron');
-			$this->assertSession()->statusCodeEquals('403');
-			$this->drupalLogin($this->gigyaAdmin);
+    $this->gigyaAdmin = $this->drupalCreateUser(['gigya major admin', 'bypass gigya raas']);
+  }
 
-			/* Same action, only after login */
-			$this->drupalGet('admin/config/gigya/cron');
-			$this->assertSession()->statusCodeEquals('200');
+  /**
+   *
+   */
+  public function testConfigPageUI() {
+    /* Checks that admin config page is not accessible without logging in */
+    $this->drupalGet('admin/config/gigya/cron');
+    $this->assertSession()->statusCodeEquals('403');
+    $this->drupalLogin($this->gigyaAdmin);
 
-			/* Form details */
-			$form_state = new FormState();
-			$values = $this->getSampleFormData();
-			$form_state->setValues($values);
-			\Drupal::formBuilder()->submitForm('Drupal\gigya_user_deletion\Form\GigyaCronForm', $form_state);
+    /* Same action, only after login */
+    $this->drupalGet('admin/config/gigya/cron');
+    $this->assertSession()->statusCodeEquals('200');
 
-			/* Get page again after values update */
-			$this->drupalGet('admin/config/gigya/cron');
-			$this->assertSession()->statusCodeEquals('200');
+    /* Form details */
+    $form_state = new FormState();
+    $values = $this->getSampleFormData();
+    $form_state->setValues($values);
+    \Drupal::formBuilder()->submitForm('Drupal\gigya_user_deletion\Form\GigyaCronForm', $form_state);
 
-			/* Form UI test */
-			$this->assertSession()->elementsCount('css', 'input[type=text]', 7);
-			$this->assertSession()->elementsCount('css', 'input[type=checkbox]', 1);
-			foreach ($this->getSampleFormData() as $form_key => $form_value)
-			{
-				$this->assertSession()->elementExists('css', '#edit-'.strtolower($form_key));
-			}
-			foreach ($this->getSampleFormData() as $form_key => $form_value)
-			{
-				$this->assertSession()->fieldValueEquals('edit-'.strtolower($form_key), $form_value);
-			}
-			$this->assertSession()->elementExists('css', '#edit-secretkey');
+    /* Get page again after values update */
+    $this->drupalGet('admin/config/gigya/cron');
+    $this->assertSession()->statusCodeEquals('200');
 
-			$this->drupalLogout();
-		}
+    /* Form UI test */
+    $this->assertSession()->elementsCount('css', 'input[type=text]', 7);
+    $this->assertSession()->elementsCount('css', 'input[type=checkbox]', 1);
+    foreach ($this->getSampleFormData() as $form_key => $form_value) {
+      $this->assertSession()->elementExists('css', '#edit-' . strtolower($form_key));
+    }
+    foreach ($this->getSampleFormData() as $form_key => $form_value) {
+      $this->assertSession()->fieldValueEquals('edit-' . strtolower($form_key), $form_value);
+    }
+    $this->assertSession()->elementExists('css', '#edit-secretkey');
 
-		public function getSampleFormData() {
-			$data = [
-				'jobFrequency' => 120,
-				'emailOnSuccess' => 'yan.na@gigya-inc.com, yan@mailinator.com',
-				'emailOnFailure' => 'yan.na@gigya-inc.com',
-				'bucketName' => 'mock-test',
-				'accessKey' => 'access-key',
-				'objectKeyPrefix' => 'sample-dir',
-			];
+    $this->drupalLogout();
+  }
 
-			return $data;
-		}
-	}
\ No newline at end of file
+  /**
+   *
+   */
+  public function getSampleFormData() {
+    $data = [
+      'jobFrequency' => 120,
+      'emailOnSuccess' => 'yan.na@gigya-inc.com, yan@mailinator.com',
+      'emailOnFailure' => 'yan.na@gigya-inc.com',
+      'bucketName' => 'mock-test',
+      'accessKey' => 'access-key',
+      'objectKeyPrefix' => 'sample-dir',
+    ];
+
+    return $data;
+  }
+
+}
diff --git a/gigya_user_deletion/tests/src/Unit/GigyaUserDeletionUnitTest.php b/gigya_user_deletion/tests/src/Unit/GigyaUserDeletionUnitTest.php
index 1afd74b..806559d 100755
--- a/gigya_user_deletion/tests/src/Unit/GigyaUserDeletionUnitTest.php
+++ b/gigya_user_deletion/tests/src/Unit/GigyaUserDeletionUnitTest.php
@@ -1,161 +1,187 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: Yan Nasonov
-	 * Date: 23/11/2017
-	 * Time: 10:46
-	 */
-
-	use Drupal\Tests\UnitTestCase;
-	use Drupal\gigya_user_deletion\Helper\GigyaUserDeletionHelper;
-	use Drupal\Core\DependencyInjection\ContainerBuilder;
-	use Drupal\Core\Logger\LoggerChannelFactory;
-
-	class GigyaUserDeletionUnitTest extends UnitTestCase
-	{
-		private $configFactory;
-		private $configContainer;
-		private $loggerFactory;
-		private $mailFactory;
-		private $config;
-
-		private $coreModuleHelperMock;
-
-		/* Set AWS details here for test */
-		/**
-		 * @var bool
-		 */
-		private $testRealAws = true;
-
-		/**
-		 * @var string
-		 */
-		private $secretKey = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsBucketName = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsAccessKey = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsExpectedRegion = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsFileName = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsFolderName = '';
-
-		/**
-		 * @var string
-		 */
-		private $awsFileContents = '';
-
-		public function setUp() {
-			/* Service mocks */
-			$this->config = $this->getMockBuilder('\Drupal\Core\Config\ImmutableConfig')
-				->disableOriginalConstructor()
-				->getMock();
-			$this->configFactory = $this->getConfigFactoryStub(array(
-																   'gigya_user_deletion.job' => array(
-																	   'gigya_user_deletion.storageDetails' => array(
-																		   'bucketName' => $this->awsBucketName,
-																		   'accessKey' => $this->awsAccessKey,
-																		   'secretKey' => 'test_key',
-																		   'objectKeyPrefix' => $this->awsFolderName,
-																	   ),
-																   ),
-																   'gigya.global' => array(
-																	   'gigya.keyPath' => '/path/to/key/file.key',
-																   ),
-															   ));
-			$this->loggerFactory = new LoggerChannelFactory();
-			$this->mailFactory = new \Drupal\Tests\Core\Mail\MailManagerTest();
-			$this->configContainer = new ContainerBuilder();
-			$this->configContainer->set('config.factory', $this->configFactory);
-			$this->configContainer->set('logger.factory', $this->loggerFactory);
-			$this->configContainer->set('plugin.manager.mail', $this->mailFactory);
-			\Drupal::setContainer($this->configContainer);
-
-			/* Gigya Helper mocks */
-			$key = $this->secretKey;
-			$this->coreModuleHelperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
-				->setMethods(array('getEncKeyFile', 'decrypt'))
-				->getMock();
-			$this->coreModuleHelperMock->expects($this->any())->method('getEncKeyFile')->willReturn(false);
-			$this->coreModuleHelperMock->expects($this->any())->method('decrypt')->will($this->returnCallback(function() use ($key) {
-				return $this->secretKey;
-			}));
-		}
-
-		public function testGetRegion() {
-			$userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
-
-			if ($this->testRealAws)
-			{
-				$expected = $this->awsExpectedRegion;
-				$this->assertEquals($expected, $userDeletionHelper->getRegion());
-			}
-			else
-				$this->assertEquals(true, true); // TODO: Implement mock for S3 service
-		}
-
-		public function testLoadFileFromServer() {
-			$userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
-
-			if ($this->testRealAws)
-			{
-				$expected = $this->awsFileContents;
-				$this->assertEquals($expected, $userDeletionHelper->loadFileFromServer($this->awsFolderName . '/' . $this->awsFileName));
-			}
-			else
-				$this->assertEquals(true, true); // TODO: Implement mock for S3 service
-		}
-
-		private function uid_csv_parse($csv_file_string) {
-			$csv_lines = explode("\n", $csv_file_string);
-			array_shift($csv_lines);
-			foreach ($csv_lines as $key => $line)
-			{
-				$csv_lines[$key] = array('UID' => trim($line));
-			}
-			return $csv_lines;
-		}
-
-		public function testGetUsers() {
-			$userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
-
-			if ($this->testRealAws)
-			{
-				$expected = $this->uid_csv_parse($this->awsFileContents);
-				$this->assertEquals($expected, $userDeletionHelper->getUsers($this->awsFolderName . '/' . $this->awsFileName));
-			}
-			else
-				$this->assertEquals(true, true); // TODO: Implement mock for S3 service
-		}
-
-		public function testGetFileList() {
-			$userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
-
-			if ($this->testRealAws)
-			{
-				$file_list = $userDeletionHelper->getFileList();
-				array_shift($file_list);
-				$expected = $this->awsFolderName . '/' . $this->awsFileName;
-				$this->assertEquals($expected, $file_list[0]['Key']);
-			}
-			else
-				$this->assertEquals(true, true); // TODO: Implement mock for S3 service
-		}
-	}
+
+    /**
+     * Created by PhpStorm.
+     * User: Yan Nasonov
+     * Date: 23/11/2017
+     * Time: 10:46.
+     */
+
+    use Drupal\Tests\Core\Mail\MailManagerTest;
+use Drupal\Tests\UnitTestCase;
+use Drupal\gigya_user_deletion\Helper\GigyaUserDeletionHelper;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Logger\LoggerChannelFactory;
+
+/**
+ *
+ */
+class GigyaUserDeletionUnitTest extends UnitTestCase {
+  private $configFactory;
+  private $configContainer;
+  private $loggerFactory;
+  private $mailFactory;
+  private $config;
+
+  private $coreModuleHelperMock;
+
+  /* Set AWS details here for test */
+  /**
+   * @var bool
+   */
+  private $testRealAws = TRUE;
+
+  /**
+   * @var string
+   */
+  private $secretKey = '';
+
+  /**
+   * @var string
+   */
+  private $awsBucketName = '';
+
+  /**
+   * @var string
+   */
+  private $awsAccessKey = '';
+
+  /**
+   * @var string
+   */
+  private $awsExpectedRegion = '';
+
+  /**
+   * @var string
+   */
+  private $awsFileName = '';
+
+  /**
+   * @var string
+   */
+  private $awsFolderName = '';
+
+  /**
+   * @var string
+   */
+  private $awsFileContents = '';
+
+  /**
+   *
+   */
+  public function setUp() {
+    /* Service mocks */
+    $this->config = $this->getMockBuilder('\Drupal\Core\Config\ImmutableConfig')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $this->configFactory = $this->getConfigFactoryStub([
+      'gigya_user_deletion.job' => [
+        'gigya_user_deletion.storageDetails' => [
+          'bucketName' => $this->awsBucketName,
+          'accessKey' => $this->awsAccessKey,
+          'secretKey' => 'test_key',
+          'objectKeyPrefix' => $this->awsFolderName,
+        ],
+      ],
+      'gigya.global' => [
+        'gigya.keyPath' => '/path/to/key/file.key',
+      ],
+    ]);
+    $this->loggerFactory = new LoggerChannelFactory();
+    $this->mailFactory = new MailManagerTest();
+    $this->configContainer = new ContainerBuilder();
+    $this->configContainer->set('config.factory', $this->configFactory);
+    $this->configContainer->set('logger.factory', $this->loggerFactory);
+    $this->configContainer->set('plugin.manager.mail', $this->mailFactory);
+    \Drupal::setContainer($this->configContainer);
+
+    /* Gigya Helper mocks */
+    $key = $this->secretKey;
+    $this->coreModuleHelperMock = $this->getMockBuilder('\Drupal\gigya\Helper\GigyaHelper')
+      ->setMethods(['getEncKeyFile', 'decrypt'])
+      ->getMock();
+    $this->coreModuleHelperMock->expects($this->any())->method('getEncKeyFile')->willReturn(FALSE);
+    $this->coreModuleHelperMock->expects($this->any())->method('decrypt')->will($this->returnCallback(function () use ($key) {
+      return $this->secretKey;
+    }));
+  }
+
+  /**
+   *
+   */
+  public function testGetRegion() {
+    $userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
+
+    if ($this->testRealAws) {
+      $expected = $this->awsExpectedRegion;
+      $this->assertEquals($expected, $userDeletionHelper->getRegion());
+    }
+    // TODO: Implement mock for S3 service.
+    else {
+      $this->assertEquals(TRUE, TRUE);
+    }
+  }
+
+  /**
+   *
+   */
+  public function testLoadFileFromServer() {
+    $userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
+
+    if ($this->testRealAws) {
+      $expected = $this->awsFileContents;
+      $this->assertEquals($expected, $userDeletionHelper->loadFileFromServer($this->awsFolderName . '/' . $this->awsFileName));
+    }
+    // TODO: Implement mock for S3 service.
+    else {
+      $this->assertEquals(TRUE, TRUE);
+    }
+  }
+
+  /**
+   *
+   */
+  private function uid_csv_parse($csv_file_string) {
+    $csv_lines = explode("\n", $csv_file_string);
+    array_shift($csv_lines);
+    foreach ($csv_lines as $key => $line) {
+      $csv_lines[$key] = ['UID' => trim($line)];
+    }
+    return $csv_lines;
+  }
+
+  /**
+   *
+   */
+  public function testGetUsers() {
+    $userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
+
+    if ($this->testRealAws) {
+      $expected = $this->uid_csv_parse($this->awsFileContents);
+      $this->assertEquals($expected, $userDeletionHelper->getUsers($this->awsFolderName . '/' . $this->awsFileName));
+    }
+    // TODO: Implement mock for S3 service.
+    else {
+      $this->assertEquals(TRUE, TRUE);
+    }
+  }
+
+  /**
+   *
+   */
+  public function testGetFileList() {
+    $userDeletionHelper = new GigyaUserDeletionHelper($this->coreModuleHelperMock);
+
+    if ($this->testRealAws) {
+      $file_list = $userDeletionHelper->getFileList();
+      array_shift($file_list);
+      $expected = $this->awsFolderName . '/' . $this->awsFileName;
+      $this->assertEquals($expected, $file_list[0]['Key']);
+    }
+    // TODO: Implement mock for S3 service.
+    else {
+      $this->assertEquals(TRUE, TRUE);
+    }
+  }
+
+}
