diff --git a/README.txt b/README.txt
index 86e061f..b1d1b7d 100644
--- a/README.txt
+++ b/README.txt
@@ -7,7 +7,8 @@ INSTALLATION:
 -------------
 1. Extract the tar.gz into your 'modules' or directory.
 2. Enable the module at 'administer >> site building >> modules'.
-3. The module will automatically replace the path to your 404 page with "search404"
+3. The module will automatically replace the path to your 404 page
+   with "search404".
 
 CONFIGURATION
 -------------
diff --git a/search404.install b/search404.install
index 905812d..c817885 100644
--- a/search404.install
+++ b/search404.install
@@ -5,12 +5,17 @@
  */
 
 /**
+ * Implements hook_install().
+ *
  * Setup Search 404 by changing Drupal's 404-page to search404.
  */
 function search404_install() {
   \Drupal::configFactory()->getEditable('system.site')->set('page.404', '/search404')->save();
 }
 
+/**
+ * Implements hook_uninstall().
+ */
 function search404_uninstall() {
   $site_404 = \Drupal::config('system.site')->get('page.404');
   if ($site_404 == 'search404') {
diff --git a/search404.links.menu.yml b/search404.links.menu.yml
index c59ccc8..9703f8d 100644
--- a/search404.links.menu.yml
+++ b/search404.links.menu.yml
@@ -2,4 +2,4 @@ search404.settings:
   title: 'Search 404 settings'
   parent: system.admin_config_search
   route_name: search404.settings
-  description: 'Configure searching for keywords from URLs that result in 404 errors'
\ No newline at end of file
+  description: 'Configure searching for keywords from URLs that result in 404 errors.'
diff --git a/src/Controller/Search404Controller.php b/src/Controller/Search404Controller.php
index a88f644..92848f8 100644
--- a/src/Controller/Search404Controller.php
+++ b/src/Controller/Search404Controller.php
@@ -1,5 +1,4 @@
 <?php
-
 namespace Drupal\search404\Controller;
 
 use Drupal\Component\Utility\Unicode;
@@ -11,19 +10,20 @@ use Symfony\Component\HttpFoundation\Request;
 use Drupal\search\Entity\SearchPage;
 use Drupal\Component\Utility\Html;
 
-
-
 /**
  * Route controller for search.
  */
 class Search404Controller extends ControllerBase {
 
   /**
+   * Protected variable.
+   *
    * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
    */
   protected $logger;
 
   /**
+   * {@inheritdoc}
    *
    * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
    *   Inject the logger channel factory interface.
@@ -55,8 +55,8 @@ class Search404Controller extends ControllerBase {
   /**
    * {@inheritdoc}
    */
-  public function search404_page(Request $request) {
-    $keys = $this->search404_get_keys();
+  public function search404Page(Request $request) {
+    $keys = $this->search404GetKeys();
     if (\Drupal::moduleHandler()->moduleExists('search') && (\Drupal::currentUser()->hasPermission('search content') || \Drupal::currentUser()->hasPermission('search by page'))) {
 
       // Get and use the default search engine for the site.
@@ -72,16 +72,16 @@ class Search404Controller extends ControllerBase {
       // and we don't want to build the results based on last time's request.
       $plugin->setSearch($keys, $request->query->all(), $request->attributes->all());
 
-
       if ($keys && !\Drupal::config('search404.settings')->get('search404_skip_auto_search')) {
-        //if custom search enabled.
+        // If custom search enabled.
         if (\Drupal::moduleHandler()->moduleExists('search_by_page') && \Drupal::config('search404.settings')->get('search404_do_search_by_page')) {
           drupal_set_message(t('The page you requested does not exist. For your convenience, a search was performed using the query %keys.', array('%keys' => Html::escape($keys))), 'error', FALSE);
-          $this->search404_goto('search_pages/' . $keys);
+          $this->search404GoTo('search_pages/' . $keys);
         }
         else {
-          // Build search results, if keywords or other search parameters are in the
-          // GET parameters. Note that we need to try the search if 'keys' is in
+          // Build search results, if keywords or other search parameters
+          // are in the GET parameters.
+          // Note that we need to try the search if 'keys' is in
           // there at all, vs. being empty, due to advanced search.
           if ($plugin->isSearchExecutable()) {
             // Log the search.
@@ -95,7 +95,8 @@ class Search404Controller extends ControllerBase {
           if (isset($results)) {
             // Jump to first result if there are results and
             // if there is only one result and if jump to first is selected or
-            // if there are more than one results and force jump to first is selected.
+            // if there are more than one results and force jump to first is
+            // selected.
             if (is_array($results) &&
                 (
                 (count($results) == 1 && \Drupal::config('search404.settings')->get('search404_jump')) || (count($results) >= 1 && \Drupal::config('search404.settings')->get('search404_first'))
@@ -107,7 +108,7 @@ class Search404Controller extends ControllerBase {
               if (isset($results[0]['#result']['link'])) {
                 $result_path = $results[0]['#result']['link'];
               }
-              $this->search404_goto($result_path);
+              $this->search404GoTo($result_path);
             }
             else {
               if (!\Drupal::config('search404.settings')->get('search404_disable_error_message')) {
@@ -121,14 +122,14 @@ class Search404Controller extends ControllerBase {
       // Construct the search form.
       $build['search_form'] = $this->entityFormBuilder()->getForm($entity, 'search');
 
-      //Set the custom page text on the top of the results.
+      // Set the custom page text on the top of the results.
       $search404_page_text = \Drupal::config('search404.settings')->get('search404_page_text');
       if (!empty($search404_page_text)) {
         $build['content']['#markup'] = '<div id="search404-page-text">' . $search404_page_text . '</div>';
         $build['content']['#weight'] = -100;
       }
 
-      //Text for,if search results is empty.
+      // Text for,if search results is empty.
       $no_results = t('<ul>
      <li>Check if your spelling is correct.</li>
      <li>Remove quotes around phrases to search for each word individually. <em>bike shed</em> will often show more results than <em>&quot;bike shed&quot;</em>.</li>
@@ -159,15 +160,15 @@ class Search404Controller extends ControllerBase {
     }
     if (\Drupal::config('search404.settings')->get('search404_do_custom_search')) {
       $custom_search_path = \Drupal::config('search404.settings')->get('search404_custom_search_path');
-      // Remove query parameters before checking whether the search path exists or the user
-      // has access rights.
+      // Remove query parameters before checking whether
+      // the search path exists or the user has access rights.
       $custom_search_path_no_query = preg_replace('/\?.*/', '', $custom_search_path);
       if (\Drupal::service('path.validator')->isValid($custom_search_path_no_query)) {
         if (!\Drupal::config('search404.settings')->get('search404_disable_error_message')) {
           drupal_set_message(t('The page you requested does not exist. For your convenience, a search was performed using the query %keys.', array('%keys' => Html::escape($keys))), 'error', FALSE);
         }
         $custom_search_path = str_replace('@keys', $keys, $custom_search_path);
-        $this->search404_goto($custom_search_path);
+        $this->search404GoTo($custom_search_path);
       }
     }
 
@@ -179,22 +180,23 @@ class Search404Controller extends ControllerBase {
 
   /**
    * Search404 drupal_goto helper function.
-   * @param string $path Path to redirect
+   *
+   * @param string $path
+   *   Path to redirect.
    */
-  public function search404_goto($path = '') {
-    // set redirect response.
+  public function search404GoTo($path = '') {
+    // Set redirect response.
     $response = new RedirectResponse($path);
     if (\Drupal::config('search404.settings')->get('search404_redirect_301')) {
       $response->setStatusCode(301);
     }
     $response->send();
-    return;
   }
 
   /**
    * Detect search from search engine.
    */
-  public function search404_search_engine_query() {
+  public function search404SearchEngineQuery() {
     $engines = array(
       'altavista' => 'q',
       'aol' => 'query',
@@ -219,16 +221,17 @@ class Search404Controller extends ControllerBase {
   }
 
   /**
-   * Get the keys that are to be used for the search based either
-   * on the keywords from the URL or from the keys from the search
-   * that resulted in the 404
+   * Get the keys that are to be used for the search.
+   *
+   * The keys based either the keywords from the URL or
+   * from the keys from the search that resulted in the 404.
    */
-  public function search404_get_keys() {
+  public function search404GetKeys() {
     $keys = '';
     // Try to get keywords from the search result (if it was one)
     // that resulted in the 404 if the config is set.
     if (\Drupal::config('search404.settings')->get('search404_use_search_engine')) {
-      $keys = $this->search404_search_engine_query();
+      $keys = $this->search404SearchEngineQuery();
     }
     // If keys are not yet populated from a search engine referer
     // use keys from the path that resulted in the 404.
@@ -236,7 +239,7 @@ class Search404Controller extends ControllerBase {
       $keys = \Drupal::request()->server->get('REDIRECT_URL');
     }
 
-    // Abort query on certain extensions, e.g: gif jpg jpeg png
+    // Abort query on certain extensions, e.g: gif jpg jpeg png.
     $extensions = explode(' ', \Drupal::config('search404.settings')->get('search404_ignore_query'));
     $extensions = trim(implode('|', $extensions));
     if (!empty($extensions) && preg_match("/\.($extensions)$/i", $keys)) {
@@ -258,7 +261,7 @@ class Search404Controller extends ControllerBase {
 
     // Ignore certain words (use case insensitive search).
     $keys = array_udiff($keys, explode(' ', \Drupal::config('search404.settings')->get('search404_ignore')), 'strcasecmp');
-    // Sanitize the keys
+    // Sanitize the keys.
     foreach ($keys as $a => $b) {
       $keys[$a] = Html::escape($b);
     }
@@ -266,4 +269,5 @@ class Search404Controller extends ControllerBase {
     $keys = trim(implode($modifier, $keys));
     return $keys;
   }
+
 }
diff --git a/src/Form/Search404Settings.php b/src/Form/Search404Settings.php
index ff06329..345dd95 100644
--- a/src/Form/Search404Settings.php
+++ b/src/Form/Search404Settings.php
@@ -1,10 +1,8 @@
 <?php
- 
 namespace Drupal\search404\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Render\Element;
 
 /**
  * Configure settings for search404.
@@ -45,14 +43,14 @@ class Search404Settings extends ConfigFormBase {
       '#type' => 'checkbox',
       '#title' => t('Do a Google CSE Search instead of a Drupal Search when a 404 occurs'),
       '#description' => t('Requires Google CSE and Google CSE Search modules to be enabled.'),
-      '#attributes' => \Drupal::moduleHandler()->moduleExists('google_cse') ? array()  : array('disabled' => 'disabled'),
+      '#attributes' => \Drupal::moduleHandler()->moduleExists('google_cse') ? array() : array('disabled' => 'disabled'),
       '#default_value' => \Drupal::config('search404.settings')->get('search404_do_google_cse'),
     );
     $form['search404_do_search_by_page'] = array(
       '#type' => 'checkbox',
       '#title' => t('Do a "Search by page" Search instead of a Drupal Search when a 404 occurs'),
       '#description' => t('Requires "Search by page" module to be enabled.'),
-      '#attributes' => \Drupal::moduleHandler()->moduleExists('search_by_page') ? array()  : array('disabled' => 'disabled'),
+      '#attributes' => \Drupal::moduleHandler()->moduleExists('search_by_page') ? array() : array('disabled' => 'disabled'),
       '#default_value' => \Drupal::config('search404.settings')->get('search404_do_search_by_page'),
     );
     // Custom search path implementation.
@@ -68,8 +66,10 @@ class Search404Settings extends ConfigFormBase {
       '#description' => t('The custom search path: example: myownsearch/@keys or myownsearch?txt_s=@keys. The token "@keys" will be replaced with the search keys from the URL.'),
       '#default_value' => \Drupal::config('search404.settings')->get('search404_custom_search_path'),
     );
-    // Added for having a 301 redirect instead of the standard 302 (offered by the drupal_goto).
-    // than Core, Apache Solr, Lucene and Xapian. Can this even be done? Meta refresh?
+    // Added for having a 301 redirect instead of the standard 302
+    // (offered by the drupal_goto)
+    // than Core, Apache Solr, Lucene and Xapian.
+    // Can this even be done? Meta refresh?
     $form['search404_redirect_301'] = array(
       '#type' => 'checkbox',
       '#title' => t('Use a 301 Redirect instead of 302 Redirect'),
@@ -145,7 +145,8 @@ class Search404Settings extends ConfigFormBase {
       '#default_value' => \Drupal::config('search404.settings')->get('search404_page_text'),
       '#description' => t('You can enter a custom text message that can be displayed at the top of the search results, HTML formatting can be used.'),
     );
-    // Helps reset the site_404 variable to search404 in case the user changes it manually.
+    // Helps reset the site_404 variable to search404
+    // in case the user changes it manually.
     $form['site_404'] = array(
       '#type' => 'hidden',
       '#value' => 'search404',
@@ -160,7 +161,7 @@ class Search404Settings extends ConfigFormBase {
 
     return parent::buildForm($form, $form_state);
   }
-  
+
   /**
    * {@inheritdoc}
    */
@@ -186,4 +187,5 @@ class Search404Settings extends ConfigFormBase {
          ->save();
     parent::submitForm($form, $form_state);
   }
+
 }
