diff --git a/email_validator.module b/email_validator.module
index 61aae94..224359f 100755
--- a/email_validator.module
+++ b/email_validator.module
@@ -5,28 +5,16 @@
  * Email_validator.module.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\email_validator\Hook\EmailValidatorHooks;
 use Drupal\Core\Routing\RouteMatchInterface;
-use Drupal\email_validator\EVAForms;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function email_validator_help($route_name, RouteMatchInterface $route_match) {
-  if ($route_name === 'help.page.email_validator') {
-    $text = file_get_contents(dirname(__FILE__) . '/README.md');
-
-    if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
-      return '<pre>' . $text . '</pre>';
-    }
-    else {
-      $filter_manager = \Drupal::service('plugin.manager.filter');
-      $settings = \Drupal::configFactory()->get('markdown.settings')->getRawData();
-      $config = ['settings' => $settings];
-      $filter = $filter_manager->createInstance('markdown', $config);
-
-      return $filter->process($text, 'en');
-    }
-  }
+  return \Drupal::service(EmailValidatorHooks::class)->help($route_name, $route_match);
 }
 
 /**
@@ -35,8 +23,7 @@ function email_validator_help($route_name, RouteMatchInterface $route_match) {
  * - Reads EVA settings and check if the mails for the given form should be
  * validated.
  */
+#[LegacyHook]
 function email_validator_form_alter(&$form, &$form_state, $form_id) {
-  if (EVAForms::validateForm($form_id)) {
-    $form['#validate'][] = '\Drupal\email_validator\EVAForms::validateCustomForm';
-  }
+  \Drupal::service(EmailValidatorHooks::class)->formAlter($form, $form_state, $form_id);
 }
diff --git a/email_validator.services.yml b/email_validator.services.yml
index 5531abc..9b597d4 100755
--- a/email_validator.services.yml
+++ b/email_validator.services.yml
@@ -5,3 +5,7 @@ services:
   logger.channel.email_validator:
     parent: logger.channel_base
     arguments: ['email_validator']
+
+  Drupal\email_validator\Hook\EmailValidatorHooks:
+    class: Drupal\email_validator\Hook\EmailValidatorHooks
+    autowire: true
diff --git a/src/Hook/EmailValidatorHooks.php b/src/Hook/EmailValidatorHooks.php
new file mode 100644
index 0000000..5cd4e22
--- /dev/null
+++ b/src/Hook/EmailValidatorHooks.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Drupal\email_validator\Hook;
+
+use Drupal\email_validator\EVAForms;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for email_validator.
+ */
+class EmailValidatorHooks {
+
+  /**
+   * Implements hook_help().
+   */
+  #[Hook('help')]
+  public static function help($route_name, RouteMatchInterface $route_match) {
+    if ($route_name === 'help.page.email_validator') {
+      $text = file_get_contents(dirname(__FILE__) . '/README.md');
+      if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
+        return '<pre>' . $text . '</pre>';
+      }
+      else {
+        $filter_manager = \Drupal::service('plugin.manager.filter');
+        $settings = \Drupal::configFactory()->get('markdown.settings')->getRawData();
+        $config = [
+          'settings' => $settings,
+        ];
+        $filter = $filter_manager->createInstance('markdown', $config);
+        return $filter->process($text, 'en');
+      }
+    }
+  }
+
+  /**
+   * Implements hook_form_alter().
+   *
+   * - Reads EVA settings and check if the mails for the given form should be
+   * validated.
+   */
+  #[Hook('form_alter')]
+  public static function formAlter(&$form, &$form_state, $form_id) {
+    if (EVAForms::validateForm($form_id)) {
+      $form['#validate'][] = '\Drupal\email_validator\EVAForms::validateCustomForm';
+    }
+  }
+
+}
