diff --git a/entity_copy_reference.module b/entity_copy_reference.module
index 9feb66b..fd7c9ea 100644
--- a/entity_copy_reference.module
+++ b/entity_copy_reference.module
@@ -5,80 +5,30 @@
  * Contains entity_copy_reference.module.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\entity_copy_reference\Hook\EntityCopyReferenceHooks;
 use Drupal\Core\Routing\RouteMatchInterface;
-use Drupal\Core\Url;
-use Drupal\entity_copy_reference\EntityCopyReference;
-use Drupal\node\Entity\Node;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function entity_copy_reference_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    // Main module help for the entity_copy_reference module.
-    case 'help.page.entity_copy_reference':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('Module for easy one click node copy/clone creation') . '</p>' .
-        '<p>' . t('The module allows for configuration as to what referenced entities should be copied 
-        along with parent node (such as paragraphs or related content types') . '</p>';
-      return $output;
-
-    default:
-  }
+  return \Drupal::service(EntityCopyReferenceHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Implements hook_local_tasks_alter().
  */
+#[LegacyHook]
 function entity_copy_reference_menu_local_tasks_alter(&$data, $route_name, &$cacheability) {
-
-  // If not in edit or front end view.
-  if (
-    $route_name !== 'entity.node.edit_form'
-    && $route_name !== 'entity.node.canonical'
-  ) {
-    return;
-  }
-
-  $node = \Drupal::routeMatch()->getParameter('node');
-  $entityCopyReference = new EntityCopyReference();
-
-  if ($node->access('update') && $entityCopyReference->isCopyEnabled($node)) {
-
-    $data['tabs'][0]['entity_copy_reference.copy'] = [
-      '#theme' => 'menu_local_task',
-      '#link' => [
-        'title' => t('Copy'),
-        'url' => Url::fromRoute('entity_copy_reference.copy', [
-          'node' => $node->id(),
-        ]),
-        'localized_options' => [],
-      ],
-      '#weight' => 2,
-      '#active' => FALSE,
-      '#access' => 'use entity_copy_reference',
-    ];
-
-  }
+  \Drupal::service(EntityCopyReferenceHooks::class)->menuLocalTasksAlter($data, $route_name, $cacheability);
 }
 
 /**
  * Implements hook_entity_operation_alter().
  */
+#[LegacyHook]
 function entity_copy_reference_entity_operation_alter(&$operations, $entity) {
-  if (!$entity instanceof Node) {
-    return;
-  }
-
-  $entityCopyReference = new EntityCopyReference();
-  if ($entityCopyReference->isCopyEnabled($entity) && $entity->access('update')) {
-    $weight = (array_key_exists('edit', $operations)) ? $operations['edit']['weight'] + 1 : count($operations) + 1;
-
-    $operations['entity_copy_reference.copy'] = [
-      'title' => t('Copy'),
-      'url' => Url::fromRoute('entity_copy_reference.copy', ['node' => $entity->id()]),
-      'weight' => $weight,
-    ];
-  }
+  \Drupal::service(EntityCopyReferenceHooks::class)->entityOperationAlter($operations, $entity);
 }
diff --git a/entity_copy_reference.services.yml b/entity_copy_reference.services.yml
new file mode 100644
index 0000000..0fba02e
--- /dev/null
+++ b/entity_copy_reference.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\entity_copy_reference\Hook\EntityCopyReferenceHooks:
+    class: Drupal\entity_copy_reference\Hook\EntityCopyReferenceHooks
+    autowire: true
diff --git a/src/EntityCopyReference.php b/src/EntityCopyReference.php
index fe8b342..a2b64a7 100644
--- a/src/EntityCopyReference.php
+++ b/src/EntityCopyReference.php
@@ -40,7 +40,7 @@ class EntityCopyReference {
    * @return bool
    *   Whether the user is allowed to copy given node
    */
-  public function isCopyEnabled(Node $node, AccountProxyInterface $user = NULL) {
+  public function isCopyEnabled(Node $node, ?AccountProxyInterface $user = NULL) {
     if ($user == NULL) {
       $user = \Drupal::currentUser();
     }
@@ -93,11 +93,10 @@ class EntityCopyReference {
       $clone->created = time();
       $clone->changed = time();
 
-       // Set the author to the current user.
+      // Set the author to the current user.
       $current_user = \Drupal::currentUser();
       $clone->setOwnerId($current_user->id());
 
-
       if (array_key_exists($node->bundle(), $config['content_types'])) {
         if (isset($config['content_types'][$node->bundle()]['reference_fields']) && !empty($config['content_types'][$node->bundle()]['reference_fields'])) {
           foreach ($config['content_types'][$node->bundle()]['reference_fields'] as $field => $option) {
diff --git a/src/Hook/EntityCopyReferenceHooks.php b/src/Hook/EntityCopyReferenceHooks.php
new file mode 100644
index 0000000..ea68866
--- /dev/null
+++ b/src/Hook/EntityCopyReferenceHooks.php
@@ -0,0 +1,85 @@
+<?php
+
+namespace Drupal\entity_copy_reference\Hook;
+
+use Drupal\node\Entity\Node;
+use Drupal\Core\Url;
+use Drupal\entity_copy_reference\EntityCopyReference;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
+/**
+ * Hook implementations for entity_copy_reference.
+ */
+class EntityCopyReferenceHooks {
+  use StringTranslationTrait;
+
+  /**
+   * Implements hook_help().
+   */
+  #[Hook('help')]
+  public function help($route_name, RouteMatchInterface $route_match) {
+    switch ($route_name) {
+      // Main module help for the entity_copy_reference module.
+      case 'help.page.entity_copy_reference':
+        $output = '';
+        $output .= '<h3>' . $this->t('About') . '</h3>';
+        $output .= '<p>' . $this->t('Module for easy one click node copy/clone creation') . '</p>' . '<p>' . $this->t('The module allows for configuration as to what referenced entities should be copied 
+        along with parent node (such as paragraphs or related content types') . '</p>';
+        return $output;
+
+      default:
+    }
+  }
+
+  /**
+   * Implements hook_local_tasks_alter().
+   */
+  #[Hook('local_tasks_alter', module: 'entity_copy_reference_menu')]
+  public function menuLocalTasksAlter(&$data, $route_name, &$cacheability) {
+    // If not in edit or front end view.
+    if ($route_name !== 'entity.node.edit_form' && $route_name !== 'entity.node.canonical') {
+      return;
+    }
+    $node = \Drupal::routeMatch()->getParameter('node');
+    $entityCopyReference = new EntityCopyReference();
+    if ($node->access('update') && $entityCopyReference->isCopyEnabled($node)) {
+      $data['tabs'][0]['entity_copy_reference.copy'] = [
+        '#theme' => 'menu_local_task',
+        '#link' => [
+          'title' => $this->t('Copy'),
+          'url' => Url::fromRoute('entity_copy_reference.copy', [
+            'node' => $node->id(),
+          ]),
+          'localized_options' => [],
+        ],
+        '#weight' => 2,
+        '#active' => FALSE,
+        '#access' => 'use entity_copy_reference',
+      ];
+    }
+  }
+
+  /**
+   * Implements hook_entity_operation_alter().
+   */
+  #[Hook('entity_operation_alter')]
+  public function entityOperationAlter(&$operations, $entity) {
+    if (!$entity instanceof Node) {
+      return;
+    }
+    $entityCopyReference = new EntityCopyReference();
+    if ($entityCopyReference->isCopyEnabled($entity) && $entity->access('update')) {
+      $weight = array_key_exists('edit', $operations) ? $operations['edit']['weight'] + 1 : count($operations) + 1;
+      $operations['entity_copy_reference.copy'] = [
+        'title' => $this->t('Copy'),
+        'url' => Url::fromRoute('entity_copy_reference.copy', [
+          'node' => $entity->id(),
+        ]),
+        'weight' => $weight,
+      ];
+    }
+  }
+
+}
