diff --git a/bigmenu.module b/bigmenu.module
index 055e1c2..52d6375 100755
--- a/bigmenu.module
+++ b/bigmenu.module
@@ -6,13 +6,14 @@
  *
  * Needed when menus get too big to load on one page.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\bigmenu\Hook\BigmenuHooks;
 use Drupal\bigmenu\BigMenuForm;
 
 /**
  * Implements hook_entity_type_alter().
  */
+#[LegacyHook]
 function bigmenu_entity_type_alter(array &$entity_types) {
-  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
-  $entity_types['menu']->setFormClass('edit', BigMenuForm::class);
+  \Drupal::service(BigmenuHooks::class)->entityTypeAlter($entity_types);
 }
diff --git a/bigmenu.post_update.php b/bigmenu.post_update.php
index 94bfce4..02d882b 100644
--- a/bigmenu.post_update.php
+++ b/bigmenu.post_update.php
@@ -1,16 +1,17 @@
 <?php
 
+use Drupal\Component\Utility\DeprecationHelper;
+
 /**
  * @file
  * The bigmenu post update hook file.
  */
-
 /**
  * Install new bigmenu settings.
  */
 function bigmenu_post_update_update_settings() {
   $config = \Drupal::configFactory()->getEditable('bigmenu.settings');
   if ($config->get('max_depth') === NULL) {
-    $config->set('max_depth', 1)->save(TRUE);
+    DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.4.0', fn() => $config->set('max_depth', 1)->save(), fn() => $config->set('max_depth', 1)->save(TRUE));
   }
 }
diff --git a/bigmenu.services.yml b/bigmenu.services.yml
new file mode 100644
index 0000000..c891e3c
--- /dev/null
+++ b/bigmenu.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\bigmenu\Hook\BigmenuHooks:
+    class: Drupal\bigmenu\Hook\BigmenuHooks
+    autowire: true
diff --git a/src/Hook/BigmenuHooks.php b/src/Hook/BigmenuHooks.php
new file mode 100644
index 0000000..5d50045
--- /dev/null
+++ b/src/Hook/BigmenuHooks.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Drupal\bigmenu\Hook;
+
+use Drupal\bigmenu\BigMenuForm;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for bigmenu.
+ */
+class BigmenuHooks
+{
+    /**
+     * Implements hook_entity_type_alter().
+     */
+    #[Hook('entity_type_alter')]
+    public static function entityTypeAlter(array &$entity_types)
+    {
+        /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
+        $entity_types['menu']->setFormClass('edit', \Drupal\bigmenu\BigMenuForm::class);
+    }
+}
