diff --git a/src/CarerixService.php b/src/CarerixService.php
index 5ae427f..1b2fb10 100644
--- a/src/CarerixService.php
+++ b/src/CarerixService.php
@@ -64,6 +64,8 @@ class CarerixService implements CarerixServiceInterface {
   public static function report($message, $status = 'error', $severity = 'error') {
     if (\Drupal::currentUser()->isAuthenticated()) {
       // Set error message.
+      // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+      // This needs to be replaced, but Rector was not yet able to replace this because the type of message was set with a variable. If you need to continue to use a variable, you might consider using a switch statement.
       drupal_set_message($message, $status);
       // Watchdog.
       if ($severity == 'error') {
diff --git a/src/Controller/CRDataNodesSyncController.php b/src/Controller/CRDataNodesSyncController.php
index 71b1454..7415411 100644
--- a/src/Controller/CRDataNodesSyncController.php
+++ b/src/Controller/CRDataNodesSyncController.php
@@ -124,21 +124,21 @@ class CRDataNodesSyncController extends ControllerBase {
       foreach ($results as $resultType => $rows) {
         switch ($resultType) {
           case 'created':
-            drupal_set_message(\Drupal::translation()->formatPlural(
+            $this->messenger()->addStatus(\Drupal::translation()->formatPlural(
               count($rows),
               '1 item created.', '@count items created.'
             ));
             break;
 
           case 'updated':
-            drupal_set_message(\Drupal::translation()->formatPlural(
+            $this->messenger()->addStatus(\Drupal::translation()->formatPlural(
               count($rows),
               '1 item updated.', '@count items updated.'
             ));
             break;
 
           case 'skipped':
-            drupal_set_message(\Drupal::translation()->formatPlural(
+            $this->messenger()->addStatus(\Drupal::translation()->formatPlural(
               count($rows),
               '1 item skipped.', '@count items skipped.'
             ));
@@ -146,7 +146,7 @@ class CRDataNodesSyncController extends ControllerBase {
 
           case 'deleted':
             if ($rows) {
-              drupal_set_message(\Drupal::translation()->formatPlural(
+              $this->messenger()->addStatus(\Drupal::translation()->formatPlural(
                 $rows,
                 '1 item deleted.', '@count items deleted.'
               ));
@@ -157,7 +157,7 @@ class CRDataNodesSyncController extends ControllerBase {
     }
     else {
       $message = t('Finished with an error.');
-      drupal_set_message($message);
+      $this->messenger()->addStatus($message);
     }
   }
 
diff --git a/src/Form/CRForm.php b/src/Form/CRForm.php
index 5e79ac7..3caa293 100644
--- a/src/Form/CRForm.php
+++ b/src/Form/CRForm.php
@@ -65,9 +65,9 @@ class CRForm extends CRFormBase {
 
       if ($pubId != NULL) {
         // Set notification.
-        drupal_set_message($this->t('The job with ID %id is no longer available.', [
+        $this->messenger()->addError($this->t('The job with ID %id is no longer available.', [
           '%id' => $pubId,
-        ]), 'error', FALSE);
+        ]), FALSE);
         // Render additional markup.
         $form['notify_open'] = [
           '#type' => 'markup',
@@ -215,7 +215,7 @@ class CRForm extends CRFormBase {
     // Create Carerix employee.
     $this->carerix->createEmployee($values, $files, $urls);
 
-    drupal_set_message($this->t('Thank you for your application.'));
+    $this->messenger()->addStatus($this->t('Thank you for your application.'));
 
     if (isset($this->redirectRouteName) && !empty($this->redirectRouteName)) {
       $form_state->setRedirect($this->redirectRouteName);
diff --git a/src/Form/CarerixFormEditForm.php b/src/Form/CarerixFormEditForm.php
index db2b0d6..7d5d4c4 100644
--- a/src/Form/CarerixFormEditForm.php
+++ b/src/Form/CarerixFormEditForm.php
@@ -146,9 +146,9 @@ class CarerixFormEditForm extends EntityForm {
               ->fetchAllKeyed();
             // Urge user to sync data nodes.
             if (empty(${$dataNodeType})) {
-              drupal_set_message(\Drupal::translation()->translate(
+              $this->messenger()->addWarning(\Drupal::translation()->translate(
                 'Please sync data nodes of type "@type" first.', ['@type' => $dataNodeType]
-              ), 'warning');
+              ));
             }
           }
           // Build mapping render array.
@@ -233,12 +233,12 @@ class CarerixFormEditForm extends EntityForm {
     $status = $carerixForm->save();
 
     if ($status) {
-      drupal_set_message($this->t('Saved the %label Carerix form.', [
+      $this->messenger()->addStatus($this->t('Saved the %label Carerix form.', [
         '%label' => $carerixForm->label(),
       ]));
     }
     else {
-      drupal_set_message($this->t('The %label Carerix form was not saved.', [
+      $this->messenger()->addStatus($this->t('The %label Carerix form was not saved.', [
         '%label' => $carerixForm->label(),
       ]));
     }
