diff --git a/save_edit.module b/save_edit.module
index 01676df..d2f0b1e 100644
--- a/save_edit.module
+++ b/save_edit.module
@@ -4,84 +4,27 @@
  * @file
  * Contains save_edit.module..
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\save_edit\Hook\SaveEditHooks;
+use Drupal\node\NodeForm;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function save_edit_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    // Main module help for the save_edit module.
-    case 'help.page.save_edit':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('Gives a &quot;Save &amp; Edit&quot; button on node pages.') . '</p>';
-      return $output;
-
-    default:
-  }
+  return \Drupal::service(SaveEditHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Implements hook_form_alter().
  */
-function save_edit_form_alter(&$form, FormStateInterface $form_state) {
-  $form_object = $form_state->getFormObject();
-  $user = \Drupal::currentUser();
-
-  // Drupal <11.2 uses \Drupal\node\NodeForm, >=11.2 uses \Drupal\node\Form\NodeForm
-  if ($user->hasPermission('use save and edit') && ($form_object instanceof \Drupal\node\NodeForm || $form_object instanceof \Drupal\node\Form\NodeForm)) {
-    $config = \Drupal::config('save_edit.settings');
-
-    $entity = $form_object->getEntity();
-    $content_type = $entity->getType();
-
-    $enabled_node_types = !is_null($config->get('node_types')) ? $config->get('node_types') : [];
-    if (in_array($content_type, array_values($enabled_node_types), TRUE)) {
-      // Let save_edit button inherit all actions from submit action.
-      $form['actions']['save_edit'] = $form['actions']['submit'];
-      if (isset($form['actions']['submit']['#attributes']) && is_object($form['actions']['submit']['#attributes'])) {
-        $form['actions']['save_edit']['#attributes'] = clone $form['actions']['submit']['#attributes'];
-      }
-      $form['actions']['save_edit']['#value'] = $config->get('button_value');
-      $form['actions']['save_edit']['#name'] = 'save_edit';
-      foreach ($form['actions']['save_edit']['#submit'] as $key => $action) {
-        if ($action == "::submitForm") {
-          array_splice($form['actions']['save_edit']['#submit'], $key + 1, 0, ['save_edit_form_submit_presave']);
-        }
-      }
-      $form['actions']['save_edit']['#submit'][] = 'save_edit_form_submit_redirect';
-      $form['actions']['save_edit']['#weight'] = $config->get('button_weight');
-      if ($config->get('gin_primary')) {
-        $form['actions']['save_edit']['#gin_action_item'] = TRUE;
-      }
-      unset($form['actions']['save_edit']['#button_type']);
-
-      // Override the default Save button text if not hidden
-      if (!$config->get('hide_default_save') && isset($form['actions']['submit'])) {
-        $save_button_text = $config->get('save_button_text');
-        if (!empty($save_button_text)) {
-          $form['actions']['submit']['#value'] = $save_button_text;
-        }
-      }
-      if ($config->get('hide_default_save')) {
-        $form['actions']['unpublish']['#access'] = FALSE;
-        $form['actions']['submit']['#access'] = FALSE;
-      }
-      if ($config->get('hide_default_publish')) {
-        $form['actions']['publish']['#access'] = FALSE;
-      }
-      if ($config->get('hide_default_preview')) {
-        $form['actions']['preview']['#access'] = FALSE;
-      }
-      if ($config->get('hide_default_delete')) {
-        $form['actions']['delete']['#access'] = FALSE;
-      }
-
-    }
-  }
+#[LegacyHook]
+function save_edit_form_alter(&$form, FormStateInterface $form_state)
+{
+    \Drupal::service(SaveEditHooks::class)->formAlter($form, $form_state);
 }
 
 /**
@@ -111,33 +54,15 @@ function save_edit_form_submit_redirect(&$form, FormStateInterface $form_state)
 /**
  * Implements hook_entity_bundle_create().
  */
+#[LegacyHook]
 function save_edit_entity_bundle_create($entity_type_id, $bundle) {
-  if ($entity_type_id == 'node') {
-    /** @var \Drupal\Core\Config\Config $config */
-    $config = \Drupal::configFactory()->getEditable('save_edit.settings');
-
-    // When a node content type entity is created, it is added to the save & edit configuration.
-    $node_types = $config->get('node_types');
-    if (!isset($node_types[$entity_type_id])) {
-      $node_types[$bundle] = ($config->get('enable_node_types_automatically')) ? $bundle : '0';
-      $config->set('node_types', $node_types)->save();
-    }
-  }
+  \Drupal::service(SaveEditHooks::class)->entityBundleCreate($entity_type_id, $bundle);
 }
 
 /**
  * Implements hook_entity_bundle_delete().
  */
+#[LegacyHook]
 function save_edit_entity_bundle_delete($entity_type_id, $bundle) {
-  if ($entity_type_id == 'node') {
-    /** @var \Drupal\Core\Config\Config $config */
-    $config = \Drupal::configFactory()->getEditable('save_edit.settings');
-
-    // When a node content type entity is deleted, it is removed from the save & edit configuration.
-    $node_types = $config->get('node_types');
-    if (isset($node_types[$bundle])) {
-      unset($node_types[$bundle]);
-      $config->set('node_types', $node_types)->save();
-    }
-  }
+  \Drupal::service(SaveEditHooks::class)->entityBundleDelete($entity_type_id, $bundle);
 }
diff --git a/save_edit.services.yml b/save_edit.services.yml
new file mode 100644
index 0000000..d565a6c
--- /dev/null
+++ b/save_edit.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\save_edit\Hook\SaveEditHooks:
+    class: Drupal\save_edit\Hook\SaveEditHooks
+    autowire: true
diff --git a/src/Hook/SaveEditHooks.php b/src/Hook/SaveEditHooks.php
new file mode 100644
index 0000000..cd3aa45
--- /dev/null
+++ b/src/Hook/SaveEditHooks.php
@@ -0,0 +1,125 @@
+<?php
+
+namespace Drupal\save_edit\Hook;
+
+use Drupal\node\NodeForm;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for save_edit.
+ */
+class SaveEditHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match)
+    {
+        switch ($route_name) {
+            // Main module help for the save_edit module.
+            case 'help.page.save_edit':
+                $output = '';
+                $output .= '<h3>' . $this->t('About') . '</h3>';
+                $output .= '<p>' . $this->t('Gives a &quot;Save &amp; Edit&quot; button on node pages.') . '</p>';
+                return $output;
+            default:
+        }
+    }
+    /**
+     * Implements hook_form_alter().
+     */
+    #[Hook('form_alter')]
+    public function formAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state)
+    {
+        $form_object = $form_state->getFormObject();
+        $user = \Drupal::currentUser();
+        // Drupal <11.2 uses \Drupal\node\NodeForm, >=11.2 uses \Drupal\node\Form\NodeForm
+        if ($user->hasPermission('use save and edit') && ($form_object instanceof \Drupal\node\NodeForm || $form_object instanceof \Drupal\node\Form\NodeForm)) {
+            $config = \Drupal::config('save_edit.settings');
+            $entity = $form_object->getEntity();
+            $content_type = $entity->getType();
+            $enabled_node_types = !is_null($config->get('node_types')) ? $config->get('node_types') : [
+            ];
+            if (in_array($content_type, array_values($enabled_node_types), TRUE)) {
+                // Let save_edit button inherit all actions from submit action.
+                $form['actions']['save_edit'] = $form['actions']['submit'];
+                if (isset($form['actions']['submit']['#attributes']) && is_object($form['actions']['submit']['#attributes'])) {
+                    $form['actions']['save_edit']['#attributes'] = clone $form['actions']['submit']['#attributes'];
+                }
+                $form['actions']['save_edit']['#value'] = $config->get('button_value');
+                $form['actions']['save_edit']['#name'] = 'save_edit';
+                foreach ($form['actions']['save_edit']['#submit'] as $key => $action) {
+                    if ($action == "::submitForm") {
+                        array_splice($form['actions']['save_edit']['#submit'], $key + 1, 0, [
+                            'save_edit_form_submit_presave',
+                        ]);
+                    }
+                }
+                $form['actions']['save_edit']['#submit'][] = 'save_edit_form_submit_redirect';
+                $form['actions']['save_edit']['#weight'] = $config->get('button_weight');
+                if ($config->get('gin_primary')) {
+                    $form['actions']['save_edit']['#gin_action_item'] = TRUE;
+                }
+                unset($form['actions']['save_edit']['#button_type']);
+                // Override the default Save button text if not hidden
+                if (!$config->get('hide_default_save') && isset($form['actions']['submit'])) {
+                    $save_button_text = $config->get('save_button_text');
+                    if (!empty($save_button_text)) {
+                        $form['actions']['submit']['#value'] = $save_button_text;
+                    }
+                }
+                if ($config->get('hide_default_save')) {
+                    $form['actions']['unpublish']['#access'] = FALSE;
+                    $form['actions']['submit']['#access'] = FALSE;
+                }
+                if ($config->get('hide_default_publish')) {
+                    $form['actions']['publish']['#access'] = FALSE;
+                }
+                if ($config->get('hide_default_preview')) {
+                    $form['actions']['preview']['#access'] = FALSE;
+                }
+                if ($config->get('hide_default_delete')) {
+                    $form['actions']['delete']['#access'] = FALSE;
+                }
+            }
+        }
+    }
+    /**
+     * Implements hook_entity_bundle_create().
+     */
+    #[Hook('entity_bundle_create')]
+    public function entityBundleCreate($entity_type_id, $bundle)
+    {
+        if ($entity_type_id == 'node') {
+            /** @var \Drupal\Core\Config\Config $config */
+            $config = \Drupal::configFactory()->getEditable('save_edit.settings');
+            // When a node content type entity is created, it is added to the save & edit configuration.
+            $node_types = $config->get('node_types');
+            if (!isset($node_types[$entity_type_id])) {
+                $node_types[$bundle] = $config->get('enable_node_types_automatically') ? $bundle : '0';
+                $config->set('node_types', $node_types)->save();
+            }
+        }
+    }
+    /**
+     * Implements hook_entity_bundle_delete().
+     */
+    #[Hook('entity_bundle_delete')]
+    public function entityBundleDelete($entity_type_id, $bundle)
+    {
+        if ($entity_type_id == 'node') {
+            /** @var \Drupal\Core\Config\Config $config */
+            $config = \Drupal::configFactory()->getEditable('save_edit.settings');
+            // When a node content type entity is deleted, it is removed from the save & edit configuration.
+            $node_types = $config->get('node_types');
+            if (isset($node_types[$bundle])) {
+                unset($node_types[$bundle]);
+                $config->set('node_types', $node_types)->save();
+            }
+        }
+    }
+}
