diff --git a/login_custom_field.admin.inc b/login_custom_field.admin.inc
old mode 100644
new mode 100755
index 3edeb0e..8b9099b
--- a/login_custom_field.admin.inc
+++ b/login_custom_field.admin.inc
@@ -8,31 +8,31 @@
 /**
  * Main settings page.
  */
- function lcf_main_settings(){
+ function lcf_main_settings() {
 
-   $form['login'] = array(
-     '#type' => 'fieldset',
-     '#title' => t('Log in'),
-   );
+  $form['login'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Log in'),
+  );
 
-   $form['login']['login_custom_field_status'] = array(
-     '#type' => 'radios',
-     '#title' => t('Enable custom field login functionality'),
-     '#description' => t('In some cases you should clear cache since the login form cached for visitors.'),
-     '#default_value' => variable_get('login_custom_field_status', 0),
-     '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
-     '#required' => TRUE,
-   );
+  $form['login']['login_custom_field_status'] = array(
+    '#type' => 'radios',
+    '#title' => t('Enable custom field login functionality'),
+    '#description' => t('In some cases you should clear cache since the login form cached for visitors.'),
+    '#default_value' => variable_get('login_custom_field_status', 0),
+    '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
+    '#required' => TRUE,
+  );
 
-   $user_object_fields = lcf_get_user_object_fields();
-   $form ['login']['login_custom_field_by_field'] = array(
-     '#type' => 'select',
-     '#title' => t('Allow login using this field'),
-     '#description' => t('You should make sure the selected field is unique.'),
-     '#options' => $user_object_fields,
-     '#default_value' => variable_get('login_custom_field_by_field'),
-     '#required' => TRUE,
-   );
+  $user_object_fields = lcf_get_user_object_fields();
+  $form['login']['login_custom_field_by_field'] = array(
+    '#type' => 'select',
+    '#title' => t('Allow login using this field'),
+    '#description' => t('You should make sure the selected field is unique.'),
+    '#options' => $user_object_fields,
+    '#default_value' => variable_get('login_custom_field_by_field'),
+    '#required' => TRUE,
+  );
 
-   return system_settings_form($form);
+  return system_settings_form($form);
  }
diff --git a/login_custom_field.functions.inc b/login_custom_field.functions.inc
old mode 100644
new mode 100755
index b325ae6..74abb39
--- a/login_custom_field.functions.inc
+++ b/login_custom_field.functions.inc
@@ -5,15 +5,18 @@
  * Helper functions for Login Custom Field module.
  */
 
-function lcf_get_user_object_fields(){
+/**
+ * Function for getting user object fields.
+ */
+function lcf_get_user_object_fields() {
 
   $fields_result = array();
   $allowed_field_types = array('number', 'phone_textfield', 'textfield');
 
   // List all user fields.
   $fields = field_info_instances('user');
-  foreach($fields['user'] as $field_key => $field){
-    if( in_array($field['widget']['type'], $allowed_field_types) ){
+  foreach ($fields['user'] as $field_key => $field) {
+    if (in_array($field['widget']['type'], $allowed_field_types)) {
       $fields_result[$field_key] = $field['label'];
     }
   }
diff --git a/login_custom_field.inc b/login_custom_field.inc
old mode 100644
new mode 100755
index ba12cc8..dc95bdf
--- a/login_custom_field.inc
+++ b/login_custom_field.inc
@@ -5,30 +5,23 @@
  * Included functions for Login Custom Field module.
  */
 
-function lcf_user_login_validate($form, &$form_state){
+/**
+ * Creating function for login validation.
+ */
+function lcf_user_login_validate($form, &$form_state) {
   module_load_include('inc', 'phone', 'include/phone.sa');
 
-  //$form_errors = form_get_errors();
-
+  // $form_errors = form_get_errors();
   if (isset($form_state['values']['name']) && $form_state['values']['name']) {
-    $query = db_select('field_data_'.variable_get('login_custom_field_by_field'), 'c')
-                ->fields('u', array('name'))
-                ->condition('c.'.variable_get('login_custom_field_by_field').'_value', format_sa_phone_number($form_state['values']['name'], array('phone_country_code'=>TRUE)), '=')
-                ->condition('c.entity_type', 'user', '=')
-                ->groupBy('c.entity_id');
+    $query = db_select('field_data_' . variable_get('login_custom_field_by_field'), 'c')
+      ->fields('u', array('name'))
+      ->condition('c.' . variable_get('login_custom_field_by_field') . '_value', format_sa_phone_number($form_state['values']['name'], array('phone_country_code' => TRUE)), '=')
+      ->condition('c.entity_type', 'user', '=')
+      ->groupBy('c.entity_id');
     $query->innerJoin('users', 'u', 'c.entity_id = u.uid');
     if ($name = $query->execute()->fetchField()) {
       form_set_value($form['name'], $name, $form_state);
     }
   }
 
-    // $query = new EntityFieldQuery();
-    // $query->entityCondition('entity_type', 'user')
-    //     ->propertyCondition('uid', 1, '<>') // User number 1 should not be able to log in using this method
-    //     ->propertyCondition('status', 1, '=')
-    //     ->fieldCondition(check_plain(variable_get('login_custom_field_by_field')), 'value', $form_errors['name'], '=')
-    //     ->fieldCondition(check_plain(variable_get('login_custom_field_by_field')), 'value', $form_errors['name'], '=')
-    //     ->range(0,1);
-    //
-//exit;
 }
diff --git a/login_custom_field.info b/login_custom_field.info
old mode 100644
new mode 100755
diff --git a/login_custom_field.module b/login_custom_field.module
old mode 100644
new mode 100755
index 976902c..d8a81a6
--- a/login_custom_field.module
+++ b/login_custom_field.module
@@ -1,14 +1,14 @@
 <?php
 
 /**
- * @file Login custom field module.
+ * @file
  * Note: lcf used as shortcut of this module name login_custom_field.
- * And it is used for all non hooks functions.
+ *
+ *  Login custom field module.
  */
 
-include('login_custom_field.inc');
-include('login_custom_field.functions.inc');
-
+include 'login_custom_field.inc';
+include 'login_custom_field.functions.inc';
 
 /**
  * Implements hook_menu().
@@ -30,21 +30,20 @@ function login_custom_field_menu() {
 }
 
 /**
- * Implement hook_form_alter().
- * Use to alter user login form and replace username with custom field if selected.
+ * Implements hook_form_alter().
  */
 function login_custom_field_form_alter(&$form, $form_state, $form_id) {
-  if ( ($form_id == 'user_login_block') || ($form_id == 'user_login') ) {
+  if (($form_id == 'user_login_block') || ($form_id == 'user_login')) {
     // Check if login by custom field is enabled or not.
-    if(variable_get('login_custom_field_status', 0) == 1){
+    if (variable_get('login_custom_field_status', 0) == 1) {
 
       // Check if selected custom field exists in user object.
       $instance = field_info_instance('user', variable_get('login_custom_field_by_field'), 'user');
-      if( isset($instance['field_name']) ){
+      if (isset($instance['field_name'])) {
         // Field is correct and exists.
         // Adding custom validation hook.
-        $form['name']['#title']       = t($instance['label']);
-        $form['name']['#description'] = t($instance['description']);
+        $form['name']['#title']       = $instance['label'];
+        $form['name']['#description'] = $instance['description'];
         // Use theme functions to print the password field's textual labels.
         $form['pass']['#title']       = theme('lt_password_title', array('form_id' => $form_id));
         $form['pass']['#description'] = theme('lt_password_description', array('form_id' => $form_id));
