diff --git a/error_reporting.module b/error_reporting.module
index d229618..3d7c36a 100644
--- a/error_reporting.module
+++ b/error_reporting.module
@@ -4,7 +4,8 @@
  * @file
  * Contains custom error display functionality.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\error_reporting\Hook\ErrorReportingHooks;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\error_reporting\Controller\ErrorController;
 use Symfony\Component\HttpFoundation\Response;
@@ -43,37 +44,24 @@ function error_reporting_exception_handler(\Throwable $exception) {
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function error_reporting_theme() {
-  return [
-    'custom_error_display' => [
-      'template' => 'custom-error-display',
-      'variables' => [
-        'data' => [],
-        'ai_fix_btn' => false,
-      ],
-    ],
-  ];
+  return \Drupal::service(ErrorReportingHooks::class)->theme();
 }
 
 /**
  * Implements hook_preprocess_HOOK() for templates.
  */
-function error_reporting_preprocess_custom_error_display(&$variables) {
-  // Get the Drupal version.
-  $variables['drupal_version'] = \Drupal::VERSION;
-  // Get the PHP version.
-  $variables['php_version'] = constant('PHP_VERSION');
+#[LegacyHook]
+function error_reporting_preprocess_custom_error_display(&$variables)
+{
+    \Drupal::service(ErrorReportingHooks::class)->preprocessCustomErrorDisplay($variables);
 }
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function error_reporting_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    case 'help.page.error_reporting':
-      // Return the help text for your module.
-      $output = '<h3>' . t('About Error Reporting Module') . '</h3>';
-      $output .= '<p>' . t('The Error Reporting module provides custom error display functionality.') . '</p>';
-      return $output;
-  }
+  return \Drupal::service(ErrorReportingHooks::class)->help($route_name, $route_match);
 }
diff --git a/error_reporting.services.yml b/error_reporting.services.yml
index 3b32b46..8660526 100644
--- a/error_reporting.services.yml
+++ b/error_reporting.services.yml
@@ -4,3 +4,7 @@ services:
     arguments: ['@renderer', '@config.factory', '@current_user']
     tags:
       - { name: 'event_subscriber' }
+
+  Drupal\error_reporting\Hook\ErrorReportingHooks:
+    class: Drupal\error_reporting\Hook\ErrorReportingHooks
+    autowire: true
diff --git a/modules/error_ai_recommendations/error_ai_recommendations.module b/modules/error_ai_recommendations/error_ai_recommendations.module
index 4e8d5ca..9566578 100644
--- a/modules/error_ai_recommendations/error_ai_recommendations.module
+++ b/modules/error_ai_recommendations/error_ai_recommendations.module
@@ -1,30 +1,16 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\error_ai_recommendations\Hook\ErrorAiRecommendationsHooks;
 use Drupal\Core\Form\FormStateInterface;
 
 /**
  * Implements hook_form_alter().
  */
-function error_ai_recommendations_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
-  if ($form_id !== 'error_reporting_config_form') {
-    return;
-  }
-
-  $config = \Drupal::config('error_reporting.settings');
-  $operation_type = 'chat';
-  $providers = error_ai_recommendations_provider_options($operation_type);
-  $providerManager = Drupal::getContainer()->get('ai.provider');
-  $defaults = $providerManager->getDefaultProviderForOperationType($operation_type);
-
-  $form['provider'] = [
-    '#type' => 'select',
-    '#title' => t('Select AI Provider'),
-    '#options' => ['' => t('Select AI Provider')] + $providers,
-    '#default_value' => $config->get('provider') ?? $defaults['provider_id'] ?? '',
-    '#description' => t('Choose the AI provider for error reporting.'),
-  ];
-
-  $form['#submit'][] = 'error_ai_recommendations_form_submit';
+#[LegacyHook]
+function error_ai_recommendations_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void
+{
+    \Drupal::service(ErrorAiRecommendationsHooks::class)->formAlter($form, $form_state, $form_id);
 }
 
 /**
diff --git a/modules/error_ai_recommendations/error_ai_recommendations.services.yml b/modules/error_ai_recommendations/error_ai_recommendations.services.yml
new file mode 100644
index 0000000..da2f134
--- /dev/null
+++ b/modules/error_ai_recommendations/error_ai_recommendations.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\error_ai_recommendations\Hook\ErrorAiRecommendationsHooks:
+    class: Drupal\error_ai_recommendations\Hook\ErrorAiRecommendationsHooks
+    autowire: true
diff --git a/modules/error_ai_recommendations/src/Hook/ErrorAiRecommendationsHooks.php b/modules/error_ai_recommendations/src/Hook/ErrorAiRecommendationsHooks.php
new file mode 100644
index 0000000..2215c41
--- /dev/null
+++ b/modules/error_ai_recommendations/src/Hook/ErrorAiRecommendationsHooks.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Drupal\error_ai_recommendations\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for error_ai_recommendations.
+ */
+class ErrorAiRecommendationsHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_form_alter().
+     */
+    #[Hook('form_alter')]
+    public function formAlter(array &$form, \Drupal\Core\Form\FormStateInterface $form_state, string $form_id): void
+    {
+        if ($form_id !== 'error_reporting_config_form') {
+            return;
+        }
+        $config = \Drupal::config('error_reporting.settings');
+        $operation_type = 'chat';
+        $providers = error_ai_recommendations_provider_options($operation_type);
+        $providerManager = \Drupal::getContainer()->get('ai.provider');
+        $defaults = $providerManager->getDefaultProviderForOperationType($operation_type);
+        $form['provider'] = [
+            '#type' => 'select',
+            '#title' => $this->t('Select AI Provider'),
+            '#options' => [
+                '' => $this->t('Select AI Provider'),
+            ] + $providers,
+            '#default_value' => $config->get('provider') ?? $defaults['provider_id'] ?? '',
+            '#description' => $this->t('Choose the AI provider for error reporting.'),
+        ];
+        $form['#submit'][] = 'error_ai_recommendations_form_submit';
+    }
+}
diff --git a/src/EventSubscriber/ExceptionSubscriber.php b/src/EventSubscriber/ExceptionSubscriber.php
index 7078984..195df29 100644
--- a/src/EventSubscriber/ExceptionSubscriber.php
+++ b/src/EventSubscriber/ExceptionSubscriber.php
@@ -66,7 +66,7 @@ class ExceptionSubscriber implements EventSubscriberInterface {
   /**
    * {@inheritdoc}
    */
-  public static function getSubscribedEvents() {
+  public static function getSubscribedEvents(): array {
     // Use a high priority to run before Symfony's default exception listener.
     $events[KernelEvents::EXCEPTION][] = ['onKernelException', 100];
     return $events;
diff --git a/src/Hook/ErrorReportingHooks.php b/src/Hook/ErrorReportingHooks.php
new file mode 100644
index 0000000..1e1a37a
--- /dev/null
+++ b/src/Hook/ErrorReportingHooks.php
@@ -0,0 +1,58 @@
+<?php
+
+namespace Drupal\error_reporting\Hook;
+
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\error_reporting\Controller\ErrorController;
+use Symfony\Component\HttpFoundation\Response;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for error_reporting.
+ */
+class ErrorReportingHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_theme().
+     */
+    #[Hook('theme')]
+    public function theme()
+    {
+        return [
+            'custom_error_display' => [
+                'template' => 'custom-error-display',
+                'variables' => [
+                    'data' => [
+                    ],
+                    'ai_fix_btn' => false,
+                ],
+            ],
+        ];
+    }
+    /**
+     * Implements hook_preprocess_HOOK() for templates.
+     */
+    #[Hook('preprocess_custom_error_display')]
+    public function preprocessCustomErrorDisplay(&$variables)
+    {
+        // Get the Drupal version.
+        $variables['drupal_version'] = \Drupal::VERSION;
+        // Get the PHP version.
+        $variables['php_version'] = constant('PHP_VERSION');
+    }
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match)
+    {
+        switch ($route_name) {
+            case 'help.page.error_reporting':
+                // Return the help text for your module.
+                $output = '<h3>' . $this->t('About Error Reporting Module') . '</h3>';
+                $output .= '<p>' . $this->t('The Error Reporting module provides custom error display functionality.') . '</p>';
+                return $output;
+        }
+    }
+}
diff --git a/tests/src/Functional/FormatterTest.php b/tests/src/Functional/FormatterTest.php
index 5763c4b..11711e3 100644
--- a/tests/src/Functional/FormatterTest.php
+++ b/tests/src/Functional/FormatterTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\error_reporting\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\error_reporting\Utility\ExceptionFormatter;
 use Drupal\Tests\BrowserTestBase;
 
@@ -10,6 +12,8 @@ use Drupal\Tests\BrowserTestBase;
  *
  * @group error_reporting
  */
+#[Group('error_reporting')]
+#[RunTestsInSeparateProcesses]
 class FormatterTest extends BrowserTestBase {
 
   /**
diff --git a/tests/src/Functional/ModuleInstallationTest.php b/tests/src/Functional/ModuleInstallationTest.php
index 12db43a..dd020ac 100644
--- a/tests/src/Functional/ModuleInstallationTest.php
+++ b/tests/src/Functional/ModuleInstallationTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\error_reporting\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\Tests\BrowserTestBase;
 
 /**
@@ -9,6 +11,8 @@ use Drupal\Tests\BrowserTestBase;
  *
  * @group error_reporting
  */
+#[Group('error_reporting')]
+#[RunTestsInSeparateProcesses]
 class ModuleInstallationTest extends BrowserTestBase {
 
   /**
