diff --git a/config/install/keycaptcha.settings.yml b/config/install/keycaptcha.settings.yml
new file mode 100644
index 0000000..fd2df86
--- /dev/null
+++ b/config/install/keycaptcha.settings.yml
@@ -0,0 +1,2 @@
+keycaptcha_js_code: ''
+keycaptcha_private_key: ''
diff --git a/config/schema/keycaptcha.schema.yml b/config/schema/keycaptcha.schema.yml
new file mode 100644
index 0000000..e7f186d
--- /dev/null
+++ b/config/schema/keycaptcha.schema.yml
@@ -0,0 +1,8 @@
+keycaptcha.settings:
+  type: mapping
+  label: Settings
+  mapping:
+    keycaptcha_js_code:
+      type: string
+    keycaptcha_private_key:
+      type: string
diff --git a/kc-gettime.php b/kc-gettime.php
index cc47861..aa4e49c 100644
--- a/kc-gettime.php
+++ b/kc-gettime.php
@@ -2,6 +2,7 @@
 
 /**
  * @file
- * Code required for KeyCAPTCHA
+ * Code required for KeyCAPTCHA.
  */
-echo (gmdate("Y/m/d H:i:s", time()));
\ No newline at end of file
+
+echo (gmdate("Y/m/d H:i:s", time()));
diff --git a/keycaptcha.admin.inc b/keycaptcha.admin.inc
deleted file mode 100644
index db57c18..0000000
--- a/keycaptcha.admin.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Code required for KeyCAPTCHA
- */
-
-/**
- * Implementation of admin settings().
- */
-function keycaptcha_admin_settings() {
-  $form = array();
-  $form['keycaptcha_private_key'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Private Key'),
-    '#default_value' => variable_get('keycaptcha_private_key', ''),
-    '#maxlength' => 40,
-    '#description' => t('You can get this key in "My sites" section at <a href="https://www.keycaptcha.com"target="_blank">www.keycaptcha.com</a> (Please note that "My sites" section is available only for users who are logged in)'),
-    '#required' => FALSE,
-  );
-  $form['keycaptcha_js_code'] = array(
-    '#type' => 'textarea',
-    '#title' => t('KeyCAPTCHA code'),
-    '#default_value' => variable_get('keycaptcha_js_code', ''),
-    '#description' => t('You can find this code in "My sites" section at <a href="https://www.keycaptcha.com">www.keycaptcha.com</a> (Please note that "My sites" section is available only for users who are logged in)'),
-    '#required' => TRUE,
-  );
-  return system_settings_form($form);
-}
-
diff --git a/keycaptcha.inc b/keycaptcha.inc
index be8b052..b15751f 100644
--- a/keycaptcha.inc
+++ b/keycaptcha.inc
@@ -2,21 +2,20 @@
 
 /**
  * @file
- * Code required for KeyCAPTCHA
+ * Code required for KeyCAPTCHA.
  */
 
 /**
- * Let the user know that the KeyCAPTCHA Private key and JS code not set
+ * Let the user know that the KeyCAPTCHA Private key and JS code not set.
  */
 function _keycaptcha_check_vars() {
   global $_keycaptcha_calledalready;
   if (!$_keycaptcha_calledalready) {
     $_keycaptcha_calledalready = TRUE;
-    $keycaptcha_js_code = variable_get('keycaptcha_js_code', '');
-    $keycaptcha_private_key = variable_get('keycaptcha_private_key', '');
-    if ( ( $keycaptcha_js_code = '' ) || ( $keycaptcha_private_key == '' ) ) {
+    $keycaptcha_js_code = \Drupal::config('keycaptcha.settings')->get('keycaptcha_js_code');
+    $keycaptcha_private_key = \Drupal::config('keycaptcha.settings')->get('keycaptcha_private_key');
+    if (($keycaptcha_js_code == '') || ($keycaptcha_private_key == '')) {
       drupal_set_message(t('You do not set the parameters ("Private key" and "KeyCAPTCHA script") for the correct working of KeyCAPTCHA. Please go to <a href="https://www.keycaptcha.com" target="_blank">KeyCAPTCHA site</a> and read installation instruction for Drupal.'), 'error');
     }
   }
 }
-
diff --git a/keycaptcha.info b/keycaptcha.info
deleted file mode 100644
index 155afc3..0000000
--- a/keycaptcha.info
+++ /dev/null
@@ -1,6 +0,0 @@
-name = KeyCAPTCHA
-description = "Uses the KeyCAPTCHA web service to improve the CAPTCHA system."
-dependencies[] = captcha
-package = "Spam control"
-core = "7.x"
-configure = admin/config/people/captcha/keycaptcha
diff --git a/keycaptcha.info.yml b/keycaptcha.info.yml
new file mode 100644
index 0000000..7ab6dc0
--- /dev/null
+++ b/keycaptcha.info.yml
@@ -0,0 +1,8 @@
+name: KeyCAPTCHA
+description: 'Uses the KeyCAPTCHA web service to improve the CAPTCHA system.'
+dependencies:
+  - captcha
+package: 'Spam control'
+core: 8.x
+configure: keycaptcha.admin_settings
+type: module
diff --git a/keycaptcha.install b/keycaptcha.install
deleted file mode 100644
index 788e0f1..0000000
--- a/keycaptcha.install
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides install, updated, and uninstall functions for keycaptcha.
- */
-
-/**
- * Implements hook_uninstall().
- */
-function keycaptcha_uninstall() {
-  // Delete all the keycaptcha variables and then clear the variable cache
-  db_query("DELETE FROM {variable} WHERE name LIKE 'keycaptcha_%'");
-  cache_clear_all('variables', 'cache');
-}
-
diff --git a/keycaptcha.links.task.yml b/keycaptcha.links.task.yml
new file mode 100644
index 0000000..b272c5b
--- /dev/null
+++ b/keycaptcha.links.task.yml
@@ -0,0 +1,3 @@
+keycaptcha.admin_settings:
+  route_name: keycaptcha.admin_settings
+  title: KeyCAPTCHA
diff --git a/keycaptcha.module b/keycaptcha.module
index 8b00361..fb8de25 100644
--- a/keycaptcha.module
+++ b/keycaptcha.module
@@ -5,7 +5,7 @@
  * Uses the KeyCAPTCHA web service to improve the CAPTCHA system.
  */
 
-if ( !class_exists('KeyCAPTCHA_CLASS') ) {
+if (!class_exists('KeyCAPTCHA_CLASS')) {
   class KeyCAPTCHA_CLASS  {
     private $c_kc_keyword = "accept";
     private $p_kc_visitor_ip = "";
@@ -38,15 +38,17 @@ if ( !class_exists('KeyCAPTCHA_CLASS') ) {
       if ($kc_vars[0] == md5($this->c_kc_keyword . $kc_vars[1] . $this->p_kc_private_key . $kc_vars[2])) {
         if (stripos($kc_vars[2], "http://") !== 0) {
           $kc_current_time = time();
-		  $kc_var_time = preg_split('/\/| |:/', $kc_vars[2]);
+          $kc_var_time = preg_split('/\/| |:/', $kc_vars[2]);
           $kc_submit_time = gmmktime($kc_var_time[3], $kc_var_time[4], $kc_var_time[5], $kc_var_time[1], $kc_var_time[2], $kc_var_time[0]);
           if (($kc_current_time - $kc_submit_time) < 15) {
             return TRUE;
           }
         }
         else {
-          if ( drupal_http_request($kc_vars[2] )->data == "1" ) {
-            return TRUE;
+          $request = \Drupal::httpClient()->get($kc_vars[2]);
+          $result = $request->getBody(TRUE);
+          if ( $result == "1" ) {
+             return TRUE;
           }
         }
       }
@@ -66,34 +68,6 @@ if ( !class_exists('KeyCAPTCHA_CLASS') ) {
 }
 
 /**
- * Implements hook_menu().
- */
-function keycaptcha_menu() {
-  $items = array();
-  $items['admin/config/people/captcha/keycaptcha'] = array(
-    'title' => 'KeyCAPTCHA',
-    'description' => 'Administer the KeyCAPTCHA web service.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('keycaptcha_admin_settings'),
-    'access arguments' => array('administer CAPTCHA settings'),
-    'type' => MENU_LOCAL_TASK,
-    'file' => 'keycaptcha.admin.inc',
-  );
-  return $items;
-}
-
-/**
- * Valid permissions for this module
- *
- * @return
- *   An array of valid permissions for the onthisdate module
- */
-function keycaptcha_perm() {
-  return array();
-}
-
-
-/**
  * Implements of hook_captcha().
  */
 function keycaptcha_captcha() {
@@ -108,9 +82,9 @@ function keycaptcha_captcha() {
       $captcha = array();
 
       if ($captcha_type == 'KeyCAPTCHA') {
-        $keycaptcha_js_code = variable_get('keycaptcha_js_code', '');
-        $keycaptcha_private_key = variable_get('keycaptcha_private_key', '');
-        if ( ( $keycaptcha_js_code = '' ) || ( $keycaptcha_private_key == '' ) ) {
+        $keycaptcha_js_code = \Drupal::config('keycaptcha.settings')->get('keycaptcha_js_code');
+        $keycaptcha_private_key = \Drupal::config('keycaptcha.settings')->get('keycaptcha_private_key');
+        if (($keycaptcha_js_code == '') || ($keycaptcha_private_key == '')) {
           drupal_set_message(t('You do not set the parameters ("Private key" and "KeyCAPTCHA script") for the correct working of KeyCAPTCHA. Please go to <a href="https://www.keycaptcha.com" target="_blank">KeyCAPTCHA site</a> and read installation instruction for Drupal.'), 'error');
         }
 
@@ -118,31 +92,37 @@ function keycaptcha_captcha() {
         $captcha['solution'] = TRUE;
         $captcha['captcha_validate'] = 'keycaptcha_captcha_validation';
         $html = '<input type=hidden name=capcode id=capcode />##keycaptchacode##';
-        $kc_o = new KeyCAPTCHA_CLASS( variable_get('keycaptcha_private_key', ''), variable_get('keycaptcha_js_code', '') );
-        $keycaptcha_form_value = str_replace( '##keycaptchacode##', $kc_o->render_js(), $html );
+        $kc_o = new KeyCAPTCHA_CLASS($keycaptcha_private_key, $keycaptcha_js_code);
+        $keycaptcha_form_value = str_replace('##keycaptchacode##', $kc_o->render_js(), $html);
 
         $captcha['form']['captcha_response'] = array(
           '#type' => 'hidden',
           '#value' => 'KeyCAPTCHA',
         );
+        $captcha['form']['capcode'] = array(
+          '#type' => 'hidden',
+          '#default_value' => '',
+          '#prefix' => '<div id="keycaptcha_custom_theme_widget">',
+        );
         $captcha['form']['captcha_form'] = array(
           '#type' => 'item',
-          '#markup' => '<div id="keycaptcha_custom_theme_widget">' . $keycaptcha_form_value . '<noscript>You should turn on JavaScript on your browser. After that please reload the page. Otherwise you won&#039;t be able to post any information on this site.</noscript></div>',
+          '#markup' => $keycaptcha_form_value . '<noscript>' . t('You should turn on JavaScript on your browser. After that please reload the page. Otherwise you won&#039;t be able to post any information on this site.') . '</noscript></div>',
+          '#allowed_tags' => ['div', 'input', 'script', 'noscript'],
         );
       }
       return $captcha;
   }
 }
 
-function keycaptcha_captcha_validation($solution = NULL, $response = NULL, $element = NULL, $form_state = NULL) {
-  if ($response == 'KeyCAPTCHA' && isset($form_state['input']['capcode'])) {
-    $kc_o = new KeyCAPTCHA_CLASS( variable_get('keycaptcha_private_key', '') );
+function keycaptcha_captcha_validation($solution = NULL, $response = NULL, $element = NULL, \Drupal\Core\Form\FormStateInterface $form_state) {
+  $code = $form_state->getValue('capcode');
+  if ($response == 'KeyCAPTCHA' && !empty($code)) {
+    $kc_o = new KeyCAPTCHA_CLASS(\Drupal::config('keycaptcha.settings')->get('keycaptcha_private_key'));
 
-    if ( !$kc_o->check_result($form_state['input']['capcode']) ) {
+    if (!$kc_o->check_result($code)) {
       return FALSE;
     }
     return TRUE;
   }
   return FALSE;
 }
-
diff --git a/keycaptcha.routing.yml b/keycaptcha.routing.yml
new file mode 100644
index 0000000..b87f0c7
--- /dev/null
+++ b/keycaptcha.routing.yml
@@ -0,0 +1,7 @@
+keycaptcha.admin_settings:
+  path: /admin/config/people/captcha/keycaptcha
+  defaults:
+    _title: KeyCAPTCHA
+    _form: \Drupal\keycaptcha\Form\KeycaptchaAdminSettings
+  requirements:
+    _permission: 'administer CAPTCHA settings'
diff --git a/src/Form/KeycaptchaAdminSettings.php b/src/Form/KeycaptchaAdminSettings.php
new file mode 100644
index 0000000..98fc8d5
--- /dev/null
+++ b/src/Form/KeycaptchaAdminSettings.php
@@ -0,0 +1,71 @@
+<?php
+
+namespace Drupal\keycaptcha\Form;
+
+use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\Element;
+
+/**
+ * Keycaptcha Configuration form.
+ */
+class KeycaptchaAdminSettings extends ConfigFormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'keycaptcha_admin_settings';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $config = $this->config('keycaptcha.settings');
+
+    foreach (Element::children($form) as $variable) {
+      $config->set($variable, $form_state->getValue($form[$variable]['#parents']));
+    }
+    $config->save();
+
+    if (method_exists($this, '_submitForm')) {
+      $this->_submitForm($form, $form_state);
+    }
+
+    parent::submitForm($form, $form_state);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEditableConfigNames() {
+    return ['keycaptcha.settings'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
+    $config = $this->config('keycaptcha.settings');
+    $settings = $config->get();
+    $form = [];
+    $form['keycaptcha_private_key'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Private Key'),
+      '#default_value' => $settings['keycaptcha_private_key'],
+      '#maxlength' => 40,
+      '#description' => $this->t('You can get this key in "My sites" section at <a href="https://www.keycaptcha.com"target="_blank">www.keycaptcha.com</a> (Please note that "My sites" section is available only for users who are logged in)'),
+      '#required' => FALSE,
+    ];
+    $form['keycaptcha_js_code'] = [
+      '#type' => 'textarea',
+      '#title' => $this->t('KeyCAPTCHA code'),
+      '#default_value' => $settings['keycaptcha_js_code'],
+      '#description' => $this->t('You can find this code in "My sites" section at <a href="https://www.keycaptcha.com">www.keycaptcha.com</a> (Please note that "My sites" section is available only for users who are logged in)'),
+      '#required' => TRUE,
+    ];
+    return parent::buildForm($form, $form_state);
+  }
+
+}
