diff --git a/modules/stats_field/src/Plugin/Field/FieldType/StatFieldItem.php b/modules/stats_field/src/Plugin/Field/FieldType/StatFieldItem.php
index 4579d6f..c86d3de 100644
--- a/modules/stats_field/src/Plugin/Field/FieldType/StatFieldItem.php
+++ b/modules/stats_field/src/Plugin/Field/FieldType/StatFieldItem.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\stats_field\Plugin\Field\FieldType;
 
+use Drupal\Core\TypedData\DataDefinitionInterface;
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\options\Plugin\Field\FieldType\ListStringItem;
@@ -28,7 +30,7 @@ class StatFieldItem extends ListStringItem {
   /**
    * {@inheritdoc}
    */
-  public function __construct(\Drupal\Core\TypedData\DataDefinitionInterface $definition, $name = NULL, \Drupal\Core\TypedData\TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
     parent::__construct($definition, $name, $parent);
     // @todo: dependency injection.
     $this->statsExecutor = \Drupal::service('stats.executor');
diff --git a/src/Form/StatProcessorDeleteForm.php b/src/Form/StatProcessorDeleteForm.php
index c57ff8c..8a3205f 100644
--- a/src/Form/StatProcessorDeleteForm.php
+++ b/src/Form/StatProcessorDeleteForm.php
@@ -38,14 +38,12 @@ class StatProcessorDeleteForm extends EntityConfirmFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->entity->delete();
 
-    drupal_set_message(
-      $this->t('content @type: deleted @label.',
-        [
-          '@type' => $this->entity->bundle(),
-          '@label' => $this->entity->label(),
-        ]
-        )
-    );
+    $this->messenger()->addStatus($this->t('content @type: deleted @label.',
+      [
+        '@type' => $this->entity->bundle(),
+        '@label' => $this->entity->label(),
+      ]
+      ));
 
     $form_state->setRedirectUrl($this->getCancelUrl());
   }
diff --git a/src/Form/StatProcessorForm.php b/src/Form/StatProcessorForm.php
index 01f6c5a..58200a2 100644
--- a/src/Form/StatProcessorForm.php
+++ b/src/Form/StatProcessorForm.php
@@ -76,13 +76,13 @@ class StatProcessorForm extends EntityForm {
 
     switch ($status) {
       case SAVED_NEW:
-        drupal_set_message($this->t('Created the %label Stat processor.', [
+        $this->messenger()->addStatus($this->t('Created the %label Stat processor.', [
           '%label' => $stat_processor->label(),
         ]));
         break;
 
       default:
-        drupal_set_message($this->t('Saved the %label Stat processor.', [
+        $this->messenger()->addStatus($this->t('Saved the %label Stat processor.', [
           '%label' => $stat_processor->label(),
         ]));
     }
diff --git a/src/StatExecution.php b/src/StatExecution.php
index 91683b5..4365193 100644
--- a/src/StatExecution.php
+++ b/src/StatExecution.php
@@ -43,7 +43,7 @@ class StatExecution {
    *
    * @return \Drupal\stats\Entity\StatProcessorInterface
    */
-  public function getStatProcessor(): \Drupal\stats\Entity\StatProcessorInterface {
+  public function getStatProcessor(): StatProcessorInterface {
     return $this->statProcessor;
   }
 
@@ -52,7 +52,7 @@ class StatExecution {
    *
    * @return \Drupal\Core\Entity\ContentEntityInterface
    */
-  public function getTriggerEntity(): \Drupal\Core\Entity\ContentEntityInterface {
+  public function getTriggerEntity(): ContentEntityInterface {
     return $this->triggerEntity;
   }
 
diff --git a/stats.module b/stats.module
index 5feeedb..86459bf 100644
--- a/stats.module
+++ b/stats.module
@@ -1,12 +1,14 @@
 <?php
 
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\ContentEntityInterface;
 /**
  * @file
  * Contains stats.module.
  */
 
-function _stats_run_executor(\Drupal\Core\Entity\EntityInterface $entity) {
-  if (!$entity instanceof \Drupal\Core\Entity\ContentEntityInterface) {
+function _stats_run_executor(EntityInterface $entity) {
+  if (!$entity instanceof ContentEntityInterface) {
     return;
   }
 
