diff --git a/fbl.install b/fbl.install
index f083c7d..324f85d 100644
--- a/fbl.install
+++ b/fbl.install
@@ -5,12 +5,10 @@
  * Install, update, and uninstall functions for the fbl module.
  */
 
-/*
+/**
  * Implements hook_uninstall().
  */
 function fbl_uninstall() {
   // Deleting the validation settings while uninstalling the module.
   \Drupal::configFactory()->getEditable('field_based_login')->delete();
 }
-
-
diff --git a/fbl.module b/fbl.module
index 439552d..a1ff870 100644
--- a/fbl.module
+++ b/fbl.module
@@ -4,11 +4,13 @@
  * @file
  * Module file for the field based login module.
  */
+
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Url;
 
 /**
- * Implements hook_help()
+ * Implements hook_help().
  */
 function fbl_help($route_name, RouteMatchInterface $route_match) {
   switch ($route_name) {
@@ -17,7 +19,7 @@ function fbl_help($route_name, RouteMatchInterface $route_match) {
       $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
       $output .= '<p>' . t('Field Based login') . '</p>';
-      $output .= '<p>' . t('This module extends drupal core user login feature, using this module admin is allows to configure user account field as loggable. like mobile number or serial number field & users can login with the same mobile number or serial number field. for more info visit <a href="@link">here</a>.', array('@link' => 'https://www.drupal.org/project/fbl')) . '</p>';
+      $output .= '<p>' . t('This module extends drupal core user login feature, using this module admin is allows to configure user account field as loggable. like mobile number or serial number field & users can login with the same mobile number or serial number field. for more info visit <a href="@link">here</a>.', ['@link' => 'https://www.drupal.org/project/fbl'] . '</p>');
       $output .= '<h3>' . t('Uses') . '</h3>';
       $output .= '<dl>';
       $output .= '<dt>' . t('Assigning user field to user login') . '</dt>';
@@ -26,7 +28,7 @@ function fbl_help($route_name, RouteMatchInterface $route_match) {
 }
 
 /**
- * Implement hook_form_alter().
+ * Implements hook_form_alter().
  */
 function fbl_form_alter(&$form, FormStateInterface $form_state, $form_id) {
 
@@ -39,7 +41,7 @@ function fbl_form_alter(&$form, FormStateInterface $form_state, $form_id) {
       $form['name']['#title'] = $fbl_value['label'];
     }
     if ($form_id == 'user_login_form' && !empty($fbl_value['field_desc'])) {
-      $form['name']['#description'] = t("@unique_field_desc", array('@unique_field_desc' => $fbl_value['field_desc']));
+      $form['name']['#description'] = t("@unique_field_desc", ['@unique_field_desc' => $fbl_value['field_desc']]);
     }
   }
   // Set fbl validator on top of other register validators.
@@ -49,7 +51,7 @@ function fbl_form_alter(&$form, FormStateInterface $form_state, $form_id) {
 
 }
 
-/*
+/**
  * Implementation of fbl_user_register_validate().
  */
 function fbl_user_register_validate($form, FormStateInterface &$form_state) {
@@ -68,14 +70,14 @@ function fbl_user_register_validate($form, FormStateInterface &$form_state) {
   }
 }
 
-/*
+/**
  * Custom validate function to check custom user field records.
  */
 function fbl_login_name_validate($form, FormStateInterface &$form_state) {
   // Load fbl configurations.
   $fbl_config = \Drupal::config('fbl.settings');
   $fbl_value = $fbl_config->get('field_based_login');
-  // If configuration not yet set, then allow users to login by username
+  // If configuration not yet set, then allow users to login by username.
   $allow_user_login_by_name = isset($fbl_value['allow_user_name']) ? $fbl_value['allow_user_name'] : 1;
   $allow_user_login_by_email = $fbl_value['allow_user_email'];
   $user_not_found = TRUE;
@@ -88,17 +90,17 @@ function fbl_login_name_validate($form, FormStateInterface &$form_state) {
 
       if ($results) {
         $user_not_found = FALSE;
-        // Check for multiple records
+        // Check for multiple records.
         if (count($results) > 1) {
           $form_state->setErrorByName('name', t('Sorry, Please contact administration. There are multiple user records found with same input.'));
-          // todo : enter field information
-          \Drupal::logger('user')->notice('Login attempt failed for %user. with field', array('%user' => $login_input));
+          // Todo : enter field information.
+          \Drupal::logger('user')->notice('Login attempt failed for %user. with field', ['%user' => $login_input]);
         }
         else {
           $uid = array_keys($results)[0];
           $connection = \Drupal::database();
           $query = $connection->select('users_field_data', 'u');
-          $query->fields('u', array('name'));
+          $query->fields('u', ['name']);
           $query->condition('u.uid', $uid);
           $name = $query->execute()->fetchObject();
           $form_state->setValue('name', $name->name);
@@ -119,8 +121,8 @@ function fbl_login_name_validate($form, FormStateInterface &$form_state) {
     }
 
     if ($user_not_found) {
-      $form_state->setErrorByName('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => \Drupal\Core\Url::fromRoute('user.pass'))));
-      \Drupal::logger('user')->notice('Login attempt failed for %user.', array('%user' => $login_input));
+      $form_state->setErrorByName('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', ['@password' => Url::fromRoute('user.pass')]));
+      \Drupal::logger('user')->notice('Login attempt failed for %user.', ['%user' => $login_input]);
     }
   }
 
diff --git a/src/Form/FblConfiguration.php b/src/Form/FblConfiguration.php
index 1a25e72..3016d1f 100644
--- a/src/Form/FblConfiguration.php
+++ b/src/Form/FblConfiguration.php
@@ -5,9 +5,42 @@ namespace Drupal\fbl\Form;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
+use Drupal\Core\Entity\EntityFieldManagerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
+/**
+ * Class FblConfiguration.
+ *
+ * @package Drupal\fbi\Form
+ */
 class FblConfiguration extends ConfigFormBase {
 
+  /**
+   * The entity type manager.
+   *
+   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
+   */
+  protected $entityFieldManager;
+
+  /**
+   * Constructs a new EntityFieldManager.
+   *
+   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_manager
+   *   The entity type manager.
+   */
+  public function __construct(EntityFieldManagerInterface $entity_manager) {
+    $this->entityFieldManager = $entity_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('entity_field.manager')
+    );
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -26,7 +59,7 @@ class FblConfiguration extends ConfigFormBase {
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    //Getting the configuration value
+    // Getting the configuration value.
     $default_value_config = $this->config('fbl.settings');
     $default_value = $default_value_config->get('field_based_login');
     $form['field_based_login'] = [
@@ -35,11 +68,11 @@ class FblConfiguration extends ConfigFormBase {
       '#collapsible' => FALSE,
       '#tree' => TRUE,
     ];
-    // todo : in feature profile 2 should work :
+    // Todo : in feature profile 2 should work :
     $entity_type_id = 'user';
     $bundle = 'user';
     $bundleFields = [];
-    foreach (\Drupal::service('entity_field.manager')->getFieldDefinitions($entity_type_id, $bundle) as $field_name => $field_definition) {
+    foreach ($this->entityFieldManager->getFieldDefinitions($entity_type_id, $bundle) as $field_name => $field_definition) {
       if (!empty($field_definition->getTargetBundle())) {
         if ($field_definition->getType() == 'string' || $field_definition->getType() == 'integer') {
           $bundleFields[$field_name] = $field_definition->getLabel();
@@ -76,7 +109,7 @@ class FblConfiguration extends ConfigFormBase {
       '#maxlength' => 60,
     ];
 
-    // added description field for configuration.
+    // Added description field for configuration.
     $form['field_based_login']['field_desc'] = [
       '#type' => 'textfield',
       '#title' => $this->t('User login form - User name field Description'),
@@ -94,10 +127,9 @@ class FblConfiguration extends ConfigFormBase {
   /**
    * {@inheritdoc}
    */
-  public function validateForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
+  public function validateForm(array &$form, FormStateInterface $form_state) {
     $field_name = $form_state->getValue(['field_based_login', 'field']);
     $allow_user_login_by_name = $form_state->getValue(['field_based_login', 'allow_user_name']);
-    //$allow_user_login_by_email = $form_state->getValue(['field_based_login', 'allow_user_email']);
     if (isset($field_name) && empty($field_name) && ($allow_user_login_by_name == 0) && ($allow_user_login_by_name == 0)) {
       $form_state->setErrorByName('field_based_login][field', $this->t('Please select any one of the option to login'));
     }
@@ -107,7 +139,7 @@ class FblConfiguration extends ConfigFormBase {
     }
     $entity_type_id = 'user';
     $bundle = 'user';
-    foreach (\Drupal::service('entity_field.manager')->getFieldDefinitions($entity_type_id, $bundle) as $field_name_value => $field_definition) {
+    foreach ($this->entityFieldManager->getFieldDefinitions($entity_type_id, $bundle) as $field_name_value => $field_definition) {
       if (!empty($field_definition->getTargetBundle())) {
         if ($field_name_value == $field_name) {
           $is_required = $field_definition->isRequired();
@@ -147,31 +179,27 @@ class FblConfiguration extends ConfigFormBase {
 
 }
 
-/*
+/**
  * Helper function to check duplicate records of user data.
  *
- * @param field_name
- *  Machine name of the user account field.
+ * @param string $field_name
+ *   Machine name of the user account field.
  */
-
-
 function _fbl_check_for_duplicates($field_name) {
   $table_name = 'user__' . $field_name;
   $table_column = $field_name . '_value';
-  //query to find the number of unique values of the login selected field
   $connection = \Drupal::database();
   $query = $connection->select($table_name, 't');
   $query->fields('t', [$table_column]);
   $query->groupBy('t.' . $table_column . '');
   $query->condition('t.bundle', 'user');
   $query->addExpression('COUNT(' . $table_column . ')', 'field_count');
-  //$query->havingCondition('t.' . $table_column, '1', '>');
   $query->range(0, 1);
   $duplicate_count = $query->execute()->fetchAll();
   foreach ($duplicate_count as $count) {
     $count = $count->field_count;
   }
-  // todo : exception handling  ??
+  // Todo : exception handling  ??
   if ($count > 1) {
     return TRUE;
   }
@@ -179,8 +207,10 @@ function _fbl_check_for_duplicates($field_name) {
 }
 
 /**
- * Returns number of user
+ * Returns number of user.
+ *
  * @return string
+ *   Returns User
  */
 function _fbl_user_count() {
   $connection = \Drupal::database();
@@ -192,10 +222,13 @@ function _fbl_user_count() {
 }
 
 /**
+ * Helper function to count.
+ *
  * @param string $field_name
+ *   Machine name of the user account field.
  *
- * @return integer
- *  Returns how many fields having value
+ * @return int
+ *   Returns how many fields having value
  */
 function _fbl_field_data_count($field_name) {
   $table_name = 'user__' . $field_name;
