diff --git a/email_domain_restriction.info.yml b/email_domain_restriction.info.yml
index ba1a7ef..832fca8 100644
--- a/email_domain_restriction.info.yml
+++ b/email_domain_restriction.info.yml
@@ -1,5 +1,6 @@
 name: Email Domain Restriction
 description: This module provides the ability to allow or deny email addresses of particular domains
 core: 8.x
+core_version_requirement: ^8 || ^9
 type: module
 configure: email_domain_restriction.settings
\ No newline at end of file
diff --git a/email_domain_restriction.module b/email_domain_restriction.module
index d1eef35..1b3b9f4 100644
--- a/email_domain_restriction.module
+++ b/email_domain_restriction.module
@@ -1,5 +1,6 @@
 <?php
 
+use Drupal\Core\Form\FormStateInterface;
 /**
  * @file
  * File: Email domain restriction module.
@@ -21,7 +22,7 @@ function email_domain_restriction_menu() {
 /**
  * Implements hook_form_form_id_form_alter().
  */
-function email_domain_restriction_form_user_register_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function email_domain_restriction_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   $form['#validate'][] = 'email_domain_restriction_email_domain_validate';
 }
 
@@ -29,7 +30,7 @@ function email_domain_restriction_form_user_register_form_alter(&$form, \Drupal\
 /**
  * Implements hook_form_form_id_form_alter().
  */
-function email_domain_restriction_form_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function email_domain_restriction_form_user_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   $config = \Drupal::config('email_domain_restriction.settings');
   $apply_existing_email = $config->get('email_domain_restriction_apply_current_fields');
   if ($apply_existing_email == 1) {
@@ -48,7 +49,7 @@ function email_domain_restriction_user_login($account) {
     $validation = email_domain_restriction_validate_email(array($email));
     if ($validation == FALSE) {
       $message = $config->get('email_domain_restriction_message_to_change');
-      drupal_set_message(t($message), 'warning');
+      \Drupal::messenger()->addWarning(t($message));
     }
   }
 }
@@ -56,7 +57,7 @@ function email_domain_restriction_user_login($account) {
 /**
  * Custom validation function.
  */
-function email_domain_restriction_email_domain_validate($form, \Drupal\Core\Form\FormStateInterface $form_state) {
+function email_domain_restriction_email_domain_validate($form, FormStateInterface $form_state) {
   $config = \Drupal::config('email_domain_restriction.settings');
   $email = $form_state->getValue('mail');
   $validation = email_domain_restriction_validate_email(array($email));
