diff --git a/bem.services.yml b/bem.services.yml
new file mode 100644
index 0000000..1188503
--- /dev/null
+++ b/bem.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\bem\Hook\BemHooks:
+    class: Drupal\bem\Hook\BemHooks
+    autowire: true
diff --git a/bem.theme b/bem.theme
index d33f55d..2bb6221 100644
--- a/bem.theme
+++ b/bem.theme
@@ -1,5 +1,7 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\bem\Hook\BemHooks;
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Template\Attribute;
@@ -16,15 +18,9 @@ function bem_preprocess_html(array &$variables) {
 /**
  * Implements hook_element_info_alter().
  */
+#[LegacyHook]
 function bem_element_info_alter(array &$types) {
-  foreach ($types as $name => $type) {
-    if (isset($type['#theme_wrappers']) && in_array('form_element', $type['#theme_wrappers'])) {
-      $types[$name]['#process'][] = '_bem_process_form_element';
-    }
-    if (isset($type['#theme_wrappers']) && in_array('details', $type['#theme_wrappers'])) {
-      $types[$name]['#process'][] = '_bem_process_form_element';
-    }
-  }
+  \Drupal::service(BemHooks::class)->elementInfoAlter($types);
 }
 
 function _bem_process_form_element(array &$element, FormStateInterface $form_state, &$complete_form) {
@@ -147,17 +143,8 @@ function bem_preprocess_user(array &$variables) {
  * @see hook_theme_suggestions_HOOK_alter()
  * @see taxonomy_theme_suggestions_taxonomy_term()
  */
-function bem_theme_suggestions_taxonomy_term_alter(array &$suggestions, array $variables) {
-  /** @var \Drupal\taxonomy\TermInterface $term */
-  $term = $variables['elements']['#taxonomy_term'];
-  // Insert before taxonomy-term--{bundle}:
-  $bundle_suggestion_pos = array_search('taxonomy_term__' . $term->bundle(), $suggestions);
-  array_splice($suggestions, $bundle_suggestion_pos, 0, [
-    'taxonomy_term__' . $variables['elements']['#view_mode'],
-  ]);
-  // Insert before taxonomy-term--{id}:
-  $id_suggestion_pos = array_search('taxonomy_term__' . $term->id(), $suggestions);
-  array_splice($suggestions, $id_suggestion_pos, 0, [
-    'taxonomy_term__' . $term->bundle() . '__' . $variables['elements']['#view_mode'],
-  ]);
+#[LegacyHook]
+function bem_theme_suggestions_taxonomy_term_alter(array &$suggestions, array $variables)
+{
+    \Drupal::service(BemHooks::class)->themeSuggestionsTaxonomyTermAlter($suggestions, $variables);
 }
diff --git a/src/Hook/BemHooks.php b/src/Hook/BemHooks.php
new file mode 100644
index 0000000..042e64f
--- /dev/null
+++ b/src/Hook/BemHooks.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Drupal\bem\Hook;
+
+use Drupal\Component\Utility\Html;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Template\Attribute;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for bem.
+ */
+class BemHooks
+{
+    /**
+     * Implements hook_element_info_alter().
+     */
+    #[Hook('element_info_alter')]
+    public function elementInfoAlter(array &$types)
+    {
+        foreach ($types as $name => $type) {
+            if (isset($type['#theme_wrappers']) && in_array('form_element', $type['#theme_wrappers'])) {
+                $types[$name]['#process'][] = '_bem_process_form_element';
+            }
+            if (isset($type['#theme_wrappers']) && in_array('details', $type['#theme_wrappers'])) {
+                $types[$name]['#process'][] = '_bem_process_form_element';
+            }
+        }
+    }
+    /**
+     * Implements hook_theme_suggestions_HOOK_alter().
+     *
+     * @see hook_theme_suggestions_HOOK_alter()
+     * @see taxonomy_theme_suggestions_taxonomy_term()
+     */
+    #[Hook('theme_suggestions_taxonomy_term_alter')]
+    public function themeSuggestionsTaxonomyTermAlter(array &$suggestions, array $variables)
+    {
+        /** @var \Drupal\taxonomy\TermInterface $term */
+        $term = $variables['elements']['#taxonomy_term'];
+        // Insert before taxonomy-term--{bundle}:
+        $bundle_suggestion_pos = array_search('taxonomy_term__' . $term->bundle(), $suggestions);
+        array_splice($suggestions, $bundle_suggestion_pos, 0, [
+            'taxonomy_term__' . $variables['elements']['#view_mode'],
+        ]);
+        // Insert before taxonomy-term--{id}:
+        $id_suggestion_pos = array_search('taxonomy_term__' . $term->id(), $suggestions);
+        array_splice($suggestions, $id_suggestion_pos, 0, [
+            'taxonomy_term__' . $term->bundle() . '__' . $variables['elements']['#view_mode'],
+        ]);
+    }
+}
