diff --git a/sendpulse_api.module b/sendpulse_api.module
index 1b6f3d3..5666abb 100644
--- a/sendpulse_api.module
+++ b/sendpulse_api.module
@@ -4,7 +4,8 @@
  * @file
  * Contains sendpulse_api.module.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\sendpulse_api\Hook\SendpulseApiHooks;
 use Drupal\Core\Entity\ContentEntityFormInterface;
 use Drupal\Core\Entity\ContentEntityType;
 use Drupal\Core\Entity\EntityInterface;
@@ -14,37 +15,18 @@ use Drupal\Core\Routing\RouteMatchInterface;
 /**
  * Implements hook_cron().
  */
-function sendpulse_api_cron() {
-  $cc = \Drupal::service('sendpulse_api');
-
-  $cc->getMailingLists(FALSE);
+#[LegacyHook]
+function sendpulse_api_cron()
+{
+    \Drupal::service(SendpulseApiHooks::class)->cron();
 }
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function sendpulse_api_help($route_name, RouteMatchInterface $arg) {
-  switch ($route_name) {
-    case 'help.page.sendpulse_api':
-      $output = '';
-
-      // Introduction section.
-      $output .= '<h3>' . t('Introduction') . '</h3>';
-      $output .= '<p>' . t('Sendpulse Api integration module using <a href=":link">API v3</a>. :description', [
-        ':link' => 'https://sendpulse.com/integrations/api',
-        ':description' => t('It allows users to add an API key and secret generated by a Sendpulse Api account in the settings.php file (or via an admin UI). Then, users can activate/enable a list and create a block derivative for each list that is enabled. It also provides an optional REST endpoint to send signups to the CC API for enabled lists. For a full description of the module, visit the <a href=":project_link">project page</a>.', [
-          ':project_link' => 'https://www.drupal.org/project/sendpulse_api',
-        ]),
-      ]) . '</p>';
-
-      // Configuration section.
-      $output .= '<h3>' . t('Configuration') . '</h3>';
-      $output .= t('<p><a href=":link">How to install and configure the module</a></p>', [
-        ':link' => 'https://interactiveknowledge.com/insights/how-use-drupal-sendpulse-api-module',
-      ]);
-
-      return $output;
-  }
+  return \Drupal::service(SendpulseApiHooks::class)->help($route_name, $arg);
 }
 
 /**
@@ -168,17 +150,10 @@ function sendpulse_api_form_alter(array &$form, FormStateInterface $form_state,
 /**
  * Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter() for Sendpulse API lists.
  */
-function sendpulse_api_webform_options_sendpulse_api_lists_alter(array &$options, array $element = []) {
-  /** @var \Drupal\sendpulse_api\Service\SendpulseApi $sendpulseApi */
-  $sendpulseApi = \Drupal::service('sendpulse_api');
-  $lists = $sendpulseApi->getEnabledMailingLists();
-  $options = [];
-
-  if ($lists && is_array($lists) && count($lists) > 0) {
-    foreach ($lists as $list) {
-      $options[$list->list_id] = $list->name;
-    }
-  }
+#[LegacyHook]
+function sendpulse_api_webform_options_sendpulse_api_lists_alter(array &$options, array $element = [])
+{
+    \Drupal::service(SendpulseApiHooks::class)->webformOptionsSendpulseApiListsAlter($options, $element);
 }
 
 /**
diff --git a/sendpulse_api.services.yml b/sendpulse_api.services.yml
index b184615..992befd 100644
--- a/sendpulse_api.services.yml
+++ b/sendpulse_api.services.yml
@@ -2,3 +2,7 @@ services:
   sendpulse_api:
     class: Drupal\sendpulse_api\Service\SendpulseApi
     arguments: ['@cache.default', '@config.factory', '@current_user', '@logger.factory', '@messenger', '@settings', '@http_client', '@module_handler']
+
+  Drupal\sendpulse_api\Hook\SendpulseApiHooks:
+    class: Drupal\sendpulse_api\Hook\SendpulseApiHooks
+    autowire: true
diff --git a/src/Controller/AuthenticationCallback.php b/src/Controller/AuthenticationCallback.php
index 4633523..0f614a7 100644
--- a/src/Controller/AuthenticationCallback.php
+++ b/src/Controller/AuthenticationCallback.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\sendpulse_api\Controller;
 
+use Drupal\Core\Utility\Error;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Url;
 use Drupal\Core\Config\ConfigFactory;
@@ -145,11 +146,11 @@ class AuthenticationCallback extends ControllerBase {
         }
       }
       catch (RequestException $e) {
-        watchdog_exception('sendpulse_api', $e);
+        Error::logException(\Drupal::logger('sendpulse_api'), $e);
         $this->messenger->addMessage($this->t('There was a problem authorizing your account.'), $this->messenger::TYPE_ERROR);
       }
       catch (\Exception $e) {
-        watchdog_exception('sendpulse_api', $e);
+        Error::logException(\Drupal::logger('sendpulse_api'), $e);
         $this->messenger->addMessage($this->t('There was a problem authorizing your account.'), $this->messenger::TYPE_ERROR);
       }
     }
diff --git a/src/Hook/SendpulseApiHooks.php b/src/Hook/SendpulseApiHooks.php
new file mode 100644
index 0000000..9eac705
--- /dev/null
+++ b/src/Hook/SendpulseApiHooks.php
@@ -0,0 +1,70 @@
+<?php
+
+namespace Drupal\sendpulse_api\Hook;
+
+use Drupal\Core\Entity\ContentEntityFormInterface;
+use Drupal\Core\Entity\ContentEntityType;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for sendpulse_api.
+ */
+class SendpulseApiHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_cron().
+     */
+    #[Hook('cron')]
+    public function cron()
+    {
+        $cc = \Drupal::service('sendpulse_api');
+        $cc->getMailingLists(FALSE);
+    }
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, \Drupal\Core\Routing\RouteMatchInterface $arg)
+    {
+        switch ($route_name) {
+            case 'help.page.sendpulse_api':
+                $output = '';
+                // Introduction section.
+                $output .= '<h3>' . $this->t('Introduction') . '</h3>';
+                $output .= '<p>' . $this->t('Sendpulse Api integration module using <a href=":link">API v3</a>. :description', [
+                    ':link' => 'https://sendpulse.com/integrations/api',
+                    ':description' => $this->t('It allows users to add an API key and secret generated by a Sendpulse Api account in the settings.php file (or via an admin UI). Then, users can activate/enable a list and create a block derivative for each list that is enabled. It also provides an optional REST endpoint to send signups to the CC API for enabled lists. For a full description of the module, visit the <a href=":project_link">project page</a>.', [
+                        ':project_link' => 'https://www.drupal.org/project/sendpulse_api',
+                    ]),
+                ]) . '</p>';
+                // Configuration section.
+                $output .= '<h3>' . $this->t('Configuration') . '</h3>';
+                $output .= $this->t('<p><a href=":link">How to install and configure the module</a></p>', [
+                    ':link' => 'https://interactiveknowledge.com/insights/how-use-drupal-sendpulse-api-module',
+                ]);
+                return $output;
+        }
+    }
+    /**
+     * Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter() for Sendpulse API lists.
+     */
+    #[Hook('webform_options_sendpulse_api_lists_alter')]
+    public function webformOptionsSendpulseApiListsAlter(array &$options, array $element = [
+    ])
+    {
+        /** @var \Drupal\sendpulse_api\Service\SendpulseApi $sendpulseApi */
+        $sendpulseApi = \Drupal::service('sendpulse_api');
+        $lists = $sendpulseApi->getEnabledMailingLists();
+        $options = [
+        ];
+        if ($lists && is_array($lists) && count($lists) > 0) {
+            foreach ($lists as $list) {
+                $options[$list->list_id] = $list->name;
+            }
+        }
+    }
+}
diff --git a/src/Plugin/ApiClient.php b/src/Plugin/ApiClient.php
index dec4f9f..9873e87 100755
--- a/src/Plugin/ApiClient.php
+++ b/src/Plugin/ApiClient.php
@@ -222,8 +222,6 @@ class ApiClient implements ApiInterface {
     $ip = curl_getinfo($curl, CURLINFO_PRIMARY_IP);
     $curlErrors = curl_error($curl);
 
-    curl_close($curl);
-
     if ($headerCode === 401 && $this->refreshToken === 0) {
       ++$this->refreshToken;
       $this->getToken();
