diff --git a/modules/salesforce_mapping/src/Entity/MappedObject.php b/modules/salesforce_mapping/src/Entity/MappedObject.php
index 919591bbf005647129952d0b3f1dcdb512e86a24..1997224c12e6122b5bf485f411baf019ab59d495 100644
--- a/modules/salesforce_mapping/src/Entity/MappedObject.php
+++ b/modules/salesforce_mapping/src/Entity/MappedObject.php
@@ -236,6 +236,20 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
     return \Drupal::service('salesforce.client');
   }
 
+  /**
+   * Wrapper for Drupal core event_dispatcher service.
+   */
+  public function eventDispatcher() {
+    return \Drupal::service('event_dispatcher');
+  }
+
+  /**
+   * Wrapper for Drupal core logger service.
+   */
+  public function logger($log) {
+    return \Drupal::logger($log);
+  }
+
   /**
    * @return string
    */
@@ -266,7 +280,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
 
     // Previously hook_salesforce_push_params_alter.
     $params = new PushParams($mapping, $drupal_entity);
-    \Drupal::service('event_dispatcher')->dispatch(
+    $this->eventDispatcher()->dispatch(
       SalesforceEvents::PUSH_PARAMS,
       new SalesforcePushEvent($this, $params)
     );
@@ -320,7 +334,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
       ->save();
 
     // Previously hook_salesforce_push_success.
-    \Drupal::service('event_dispatcher')->dispatch(
+    $this->eventDispatcher()->dispatch(
       SalesforceEvents::PUSH_SUCCESS,
       new SalesforcePushEvent($this, $params)
     );
@@ -403,7 +417,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
         continue;
       }
 
-      \Drupal::service('event_dispatcher')->dispatch(
+      $this->eventDispatcher()->dispatch(
         SalesforceEvents::PULL_ENTITY_VALUE,
         new SalesforcePullEntityValueEvent($value, $field, $this)
       );
@@ -415,7 +429,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
       }
       catch (\Exception $e) {
         $message = t();
-        \Drupal::logger('Salesforce Pull')->notice('Exception during pull for @sfobj.@sffield @sfid to @dobj.@dprop @did with value @v: @e', [
+        $this->logger('Salesforce Pull')->notice('Exception during pull for @sfobj.@sffield @sfid to @dobj.@dprop @did with value @v: @e', [
           '@sfobj' => $mapping->getSalesforceObjectType(),
           '@sffield' => $sf_field,
           '@sfid' => $this->sfid(),
@@ -432,7 +446,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
 
 
     // @TODO: Event dispatching and entity saving should not be happening in this context, but inside a controller. This class needs to be more model-like.
-    \Drupal::service('event_dispatcher')->dispatch(
+    $this->eventDispatcher()->dispatch(
       SalesforceEvents::PULL_PRESAVE,
       new SalesforcePullEvent($this, $this->drupal_entity->isNew()
         ? MappingConstants::SALESFORCE_MAPPING_SYNC_SF_CREATE
diff --git a/modules/salesforce_mapping/src/Form/MappedObjectForm.php b/modules/salesforce_mapping/src/Form/MappedObjectForm.php
index d669af8f07f594ac2216b2564513ac6ce38bc791..ab49b296fcf61c11bf76619533772c98d3663099 100644
--- a/modules/salesforce_mapping/src/Form/MappedObjectForm.php
+++ b/modules/salesforce_mapping/src/Form/MappedObjectForm.php
@@ -5,6 +5,7 @@ namespace Drupal\salesforce_mapping\Form;
 use Drupal\Core\Entity\ContentEntityForm;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\salesforce\Exception;
 use Drupal\salesforce\Rest\RestClient;
 use Drupal\salesforce_mapping\SalesforceMappingStorage;
@@ -33,10 +34,11 @@ class MappedObjectForm extends ContentEntityForm {
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager.
    */
-  public function __construct(EntityManagerInterface $entity_manager, RestClient $rest) {
+  public function __construct(EntityManagerInterface $entity_manager, RestClient $rest, RouteMatchInterface $route_match) {
     $this->entityManager = $entity_manager;
     $this->mapping_storage = $entity_manager->getStorage('salesforce_mapping')->throwExceptions();
     $this->rest = $rest;
+    $this->route_match = $route_match;
   }
 
   /**
@@ -45,7 +47,8 @@ class MappedObjectForm extends ContentEntityForm {
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
-      $container->get('salesforce.client')
+      $container->get('salesforce.client'),
+      $container->get('current_route_match')
     );
   }
 
@@ -55,7 +58,7 @@ class MappedObjectForm extends ContentEntityForm {
   public function buildForm(array $form, FormStateInterface $form_state) {
     // Include the parent entity on the form.
     $form = parent::buildForm($form, $form_state);
-    $url_params = \Drupal::routeMatch()->getParameters();
+    $url_params = $this->route_match->getParameters();
     $drupal_entity = $this->getDrupalEntityFromUrl();
     // Allow exception to bubble up here, because we shouldn't have got here if
     // there isn't a mapping.
@@ -187,7 +190,7 @@ class MappedObjectForm extends ContentEntityForm {
   private function getDrupalEntityFromUrl() {
     // Fetch the current entity from context.
     // @TODO what if there's more than one entity in route params?
-    $params = \Drupal::routeMatch()->getParameters();
+    $params = $this->route_match->getParameters();
 
     if (empty($params)) {
       throw new \Exception('Invalid route parameters when attempting push to Salesforce.');
diff --git a/modules/salesforce_mapping/src/Form/SalesforceMappingFormCrudBase.php b/modules/salesforce_mapping/src/Form/SalesforceMappingFormCrudBase.php
index 18c4ac00a90f0e72d8e0c663205c0064246aaa72..d00b7876d17cb6072c6ae7f05eb76eda0e395063 100644
--- a/modules/salesforce_mapping/src/Form/SalesforceMappingFormCrudBase.php
+++ b/modules/salesforce_mapping/src/Form/SalesforceMappingFormCrudBase.php
@@ -78,7 +78,7 @@ abstract class SalesforceMappingFormCrudBase extends SalesforceMappingFormBase {
 
     $form['drupal_entity']['drupal_bundle'] = ['#title' => 'Drupal Bundle', '#tree' => TRUE];
     foreach ($entity_types as $entity_type => $label) {
-      $bundle_info = \Drupal::entityManager()->getBundleInfo($entity_type);
+      $bundle_info = $this->entityManager->getBundleInfo($entity_type);
       if (empty($bundle_info)) {
         continue;
       }
@@ -267,7 +267,7 @@ abstract class SalesforceMappingFormCrudBase extends SalesforceMappingFormBase {
    */
   protected function get_entity_type_options() {
     $options = [];
-    $entity_info = \Drupal::entityTypeManager()->getDefinitions();
+    $entity_info = $this->entityTypeManager->getDefinitions();
 
     // For now, let's only concern ourselves with fieldable entities. This is an
     // arbitrary restriction, but otherwise there would be dozens of entities,
diff --git a/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RecordType.php b/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RecordType.php
index 4b82b8494fb42347db410c6b97a11c03266d80f3..0e465c093f57156d8bdb8234a43fe2e5b7c69986 100644
--- a/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RecordType.php
+++ b/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RecordType.php
@@ -74,9 +74,8 @@ class RecordType extends SalesforceMappingFieldPluginBase {
    */
   public static function isAllowed(SalesforceMappingInterface $mapping) {
     try {
-      $client = \Drupal::service('salesforce.client');
       $record_types =
-        $client->getRecordTypes($mapping->getSalesforceObjectType());
+        $this->client()->getRecordTypes($mapping->getSalesforceObjectType());
       return count($record_types) > 1;
     }
     catch (\Exception $e) {
@@ -84,4 +83,11 @@ class RecordType extends SalesforceMappingFieldPluginBase {
     }
   }
 
+  /**
+   * Wrapper for Salesforce client service.
+   */
+  public function client() {
+    return \Drupal::service('salesforce.client');
+  }
+
 }
diff --git a/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RelatedProperties.php b/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RelatedProperties.php
index 5084c57acff65a0d8996450ad7d2faae9c9da4b8..44f8e82dd8e259f5164a5e4e74b4a8719dd85bf3 100644
--- a/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RelatedProperties.php
+++ b/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RelatedProperties.php
@@ -75,7 +75,8 @@ $mapping) {
     // Now we can actually fetch the referenced entity.
     $field_settings = $field->getFieldDefinition()->getFieldSettings();
     try {
-      $referenced_entity = \Drupal::entityTypeManager()
+      $referenced_entity = $this
+        ->entityTypeManager
         ->getStorage($field_settings['target_type'])
         ->load($field->value);
     }
diff --git a/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php b/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php
index c8a70928b2cec4818869a0818c03bb3d48c9186f..31db8a52482325d6ca9056e8714700d20d90191c 100644
--- a/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php
+++ b/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php
@@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\salesforce_mapping\SalesforceMappingStorage;
 use Drupal\salesforce_mapping\MappedObjectStorage;
 use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 
 /**
  * Defines a base Salesforce Mapping Field Plugin implementation.
@@ -58,6 +59,8 @@ abstract class SalesforceMappingFieldPluginBase extends PluginBase implements Sa
    */
   protected $mapped_object_storage;
 
+  protected $entityTypeManager;
+
   /**
    * Constructs a \Drupal\salesforce_mapping\Plugin\SalesforceMappingFieldPluginBase object.
    *
@@ -72,12 +75,13 @@ abstract class SalesforceMappingFieldPluginBase extends PluginBase implements Sa
    * @param \Drupal\Core\Entity\EntityFieldManagerInterface $mapping
    *   The entity manager to get the SF listing, mapped entity, etc.
    */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityFieldManagerInterface $entity_field_manager, RestClient $rest_client, EntityManagerInterface $entity_manager) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityFieldManagerInterface $entity_field_manager, RestClient $rest_client, EntityManagerInterface $entity_manager, EntityTypeManagerInterface $etm) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->entityTypeBundleInfo = $entity_type_bundle_info;
     $this->entityFieldManager = $entity_field_manager;
     $this->salesforceClient = $rest_client;
     $this->entityManager = $entity_manager;
+    $this->entityTypeManager = $etm;
     $this->mapping_storage = $entity_manager->getStorage('salesforce_mapping')->throwExceptions();
     $this->mapped_object_storage = $entity_manager->getStorage('salesforce_mapped_object')->throwExceptions();
   }
@@ -90,7 +94,8 @@ abstract class SalesforceMappingFieldPluginBase extends PluginBase implements Sa
       $container->get('entity_type.bundle.info'),   
       $container->get('entity_field.manager'),
       $container->get('salesforce.client'),
-      $container->get('entity.manager')
+      $container->get('entity.manager'),
+      $container->get('entity_type.manager')
     );
   }
 
diff --git a/modules/salesforce_pull/salesforce_pull.module b/modules/salesforce_pull/salesforce_pull.module
index 23a0e989d0e7c246b0d803cd4ef3585ccdb32568..d3fc8e8e972bae467f9a83321f6ed174c5b67e7f 100644
--- a/modules/salesforce_pull/salesforce_pull.module
+++ b/modules/salesforce_pull/salesforce_pull.module
@@ -22,7 +22,9 @@ function salesforce_pull_cron() {
         ->getStorage('salesforce_mapping')
         ->loadMultiple(),
       \Drupal::queue('cron_salesforce_pull'),
-      \Drupal::service('event_dispatcher')
+      \Drupal::service('event_dispatcher'),
+      \Drupal::request(),
+      \Drupal::logger('Salesforce Pull')
     )->getUpdatedRecords();
     DeleteHandler::create(
       $sfapi,
diff --git a/modules/salesforce_pull/src/DeleteHandler.php b/modules/salesforce_pull/src/DeleteHandler.php
index 9ec03c18da45298481501dd188c5b153f99e4b7f..d2760cbca04c8a690a55702b5e5e48885a0aade0 100644
--- a/modules/salesforce_pull/src/DeleteHandler.php
+++ b/modules/salesforce_pull/src/DeleteHandler.php
@@ -15,7 +15,6 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\State\StateInterface;
 use Psr\Log\LogLevel;
 use Psr\Log\LoggerInterface;
-use Drupal\salesforce\LoggingTrait;
 
 /**
  * Handles pull cron deletion of Drupal entities based onSF mapping settings.
@@ -25,8 +24,6 @@ use Drupal\salesforce\LoggingTrait;
 
 class DeleteHandler {
 
-  use LoggingTrait;
-
   protected $sfapi;
   protected $mapping_storage;
   protected $mapped_object_storage;
diff --git a/modules/salesforce_pull/src/QueueHandler.php b/modules/salesforce_pull/src/QueueHandler.php
index 62d84f7de4b80dcae70785d2fb93451591c5a457..ad76bf210881ed435cd0bfe54c04d6cb0040e6dc 100644
--- a/modules/salesforce_pull/src/QueueHandler.php
+++ b/modules/salesforce_pull/src/QueueHandler.php
@@ -57,8 +57,8 @@ class QueueHandler {
    *
    * @return QueueHandler
    */
-  public static function create(RestClient $sfapi, array $mappings, QueueInterface $queue, StateInterface $state, LoggerInterface $logger, ContainerAwareEventDispatcher $event_dispatcher) {
-    return new QueueHandler($sfapi, $mappings, $queue, $state, $logger, $event_dispatcher, \Drupal::request());
+  public static function create(RestClient $sfapi, array $mappings, QueueInterface $queue, StateInterface $state, LoggerInterface $logger, ContainerAwareEventDispatcher $event_dispatcher, Request $request) {
+    return new QueueHandler($sfapi, $mappings, $queue, $state, $logger, $event_dispatcher, $request);
   }
 
   /**
diff --git a/modules/salesforce_push/src/Plugin/SalesforcePushQueueProcessor/Rest.php b/modules/salesforce_push/src/Plugin/SalesforcePushQueueProcessor/Rest.php
index 0d633d878e5be4e11ddc418f9d9edadb83b5a13b..8fc240109041116c49d41bf1756ba3a9a60b2fee 100644
--- a/modules/salesforce_push/src/Plugin/SalesforcePushQueueProcessor/Rest.php
+++ b/modules/salesforce_push/src/Plugin/SalesforcePushQueueProcessor/Rest.php
@@ -46,11 +46,13 @@ class Rest extends PluginBase implements PushQueueProcessorInterface {
 
   protected $entity_manager;
   protected $event_dispatcher;
+  protected $entityTypeManager;
 
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, PushQueue $queue, RestClient $client, EntityManagerInterface $entity_manager, ContainerAwareEventDispatcher $event_dispatcher) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, PushQueue $queue, RestClient $client, EntityManagerInterface $entity_manager, EntityTypeManagerInterface $etm, ContainerAwareEventDispatcher $event_dispatcher) {
     $this->queue = $queue;
     $this->client = $client;
     $this->entity_manager = $entity_manager;
+    $this->entityTypeManager = $etm;
     $this->mapping_storage = $entity_manager->getStorage('salesforce_mapping')->throwExceptions();
     $this->mapped_object_storage = $entity_manager->getStorage('salesforce_mapped_object')->throwExceptions();
     $this->event_dispatcher = $event_dispatcher;
@@ -64,7 +66,8 @@ class Rest extends PluginBase implements PushQueueProcessorInterface {
       $container->get('queue.salesforce_push'),
       $container->get('salesforce.client'),
       $container->get('entity.manager'),
-      $container->get('event_dispatcher')
+      $container->get('entity_type.manager'),
+      $container->get('event_dispatcher'),
     );
   }
 
@@ -105,7 +108,7 @@ class Rest extends PluginBase implements PushQueueProcessorInterface {
 
     // @TODO: the following is nearly identical to the end of salesforce_push_entity_crud(). Can we DRY it? Do we care?
     try {
-      \Drupal::service('event_dispatcher')->dispatch(
+      $this->event_dispatcher->dispatch(
         SalesforceEvents::PUSH_MAPPING_OBJECT,
         new SalesforcePushEvent($mapped_object, NULL, $op)
       );
@@ -115,7 +118,7 @@ class Rest extends PluginBase implements PushQueueProcessorInterface {
         $mapped_object->pushDelete();
       }
       else {
-        $entity = \Drupal::entityTypeManager()
+        $entity = $this->entityTypeManager
           ->getStorage($mapping->drupal_entity_type)
           ->load($item->entity_id);
         if (!$entity) {
diff --git a/modules/salesforce_push/src/PushQueue.php b/modules/salesforce_push/src/PushQueue.php
index fdd36688fc480b3981f1f6c99eaf60991803e8bd..481a6a302b5226e3d66b00fade279cc66b620ce6 100644
--- a/modules/salesforce_push/src/PushQueue.php
+++ b/modules/salesforce_push/src/PushQueue.php
@@ -15,6 +15,7 @@ use Drupal\salesforce_mapping\SalesforceMappingStorage;
 use Drupal\salesforce_mapping\MappedObjectStorage;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityInterface;
+use Psr\Log\LoggerInterface;
 
 /**
  * Salesforce push queue.
@@ -60,13 +61,14 @@ class PushQueue extends DatabaseQueue {
    * @param \Drupal\Core\Database\Connection $connection
    *   The Connection object containing the key-value tables.
    */
-  public function __construct(Connection $connection, State $state, PushQueueProcessorPluginManager $queue_manager, EntityManagerInterface $entity_manager) {
+  public function __construct(Connection $connection, State $state, PushQueueProcessorPluginManager $queue_manager, EntityManagerInterface $entity_manager, LoggerInterface $logger) {
     $this->connection = $connection;
     $this->state = $state;
     $this->queueManager = $queue_manager;
     $this->entity_manager = $entity_manager;
     $this->mapping_storage = $entity_manager->getStorage('salesforce_mapping')->throwExceptions();
     $this->mapped_object_storage = $entity_manager->getStorage('salesforce_mapped_object')->throwExceptions();
+    $this->logger = $logger;
 
     $this->limit = $state->get('salesforce.push_limit', static::DEFAULT_CRON_PUSH_LIMIT);
 
@@ -283,7 +285,7 @@ class PushQueue extends DatabaseQueue {
     $i = 0;
 
     // @TODO push queue processor could be set globally, or per-mapping. Exposing some UI setting would probably be better than this:
-    $plugin_name = \Drupal::state()->get('salesforce.push_queue_processor', static::DEFAULT_QUEUE_PROCESSOR);
+    $plugin_name = $this->state->get('salesforce.push_queue_processor', static::DEFAULT_QUEUE_PROCESSOR);
 
     $queue_processor = $this->queueManager->createInstance($plugin_name);
 
@@ -350,7 +352,7 @@ class PushQueue extends DatabaseQueue {
 
     if ($e instanceof EntityNotFoundException) {
       // If there was an exception loading any entities, we assume that this queue item is no longer relevant.
-      \Drupal::logger('Salesforce Push')->error($e->getMessage() .
+      $this->logger->error($e->getMessage() .
         ' Exception while loading entity %type %id for salesforce mapping %mapping. Queue item deleted.',
         [
           '%type' => $mapping->get('drupal_entity_type'),
@@ -372,7 +374,7 @@ class PushQueue extends DatabaseQueue {
       $message = 'Queue item %item failed %fail times. Exception while pushing entity %type %id for salesforce mapping %mapping. ' . $message;
     }
 
-    \Drupal::logger('Salesforce Push')->error($message,
+    $this->log->error($message,
       [
         '%type' => $mapping->get('drupal_entity_type'),
         '%id' => $item->entity_id,
diff --git a/salesforce.services.yml b/salesforce.services.yml
index 23b04d2dbce06363409eac2aa16acb7ea163e28f..aa6ca8eeb15f2e1ec79473db6f9d3b2d60e7f312 100644
--- a/salesforce.services.yml
+++ b/salesforce.services.yml
@@ -1,4 +1,4 @@
 services:
   salesforce.client:
     class: Drupal\salesforce\Rest\RestClient
-    arguments: ['@http_client', '@config.factory', '@url_generator', '@state']
+    arguments: ['@http_client', '@config.factory', '@url_generator', '@state', '@cache.default']
diff --git a/src/Controller/SalesforceController.php b/src/Controller/SalesforceController.php
index 511fb8a1efd74f515b4377d25c2de3b38bc57b6f..0e4e238009787fe4fbaec48de7c7c65e19370fef 100644
--- a/src/Controller/SalesforceController.php
+++ b/src/Controller/SalesforceController.php
@@ -8,18 +8,22 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 use Drupal\salesforce\Rest\RestClient;
+use GuzzleHttp\Client;
+use Drupal\Core\Url;
+
 /**
  *
  */
 class SalesforceController extends ControllerBase {
 
   protected $client;
-
+  protected $http_client;
   /**
    * {@inheritdoc}
    */
-  public function __construct(RestClient $rest) {
+  public function __construct(RestClient $rest, Client $http_client) {
     $this->client = $rest;
+    $this->http_client = $http_client;
   }
 
   /**
@@ -27,7 +31,8 @@ class SalesforceController extends ControllerBase {
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('salesforce.client')
+      $container->get('salesforce.client'),
+      $container->get('http_client')
     );
   }
 
@@ -56,12 +61,11 @@ class SalesforceController extends ControllerBase {
       'Content-Type' => 'application/x-www-form-urlencoded',
     ];
 
-    $http_client = \Drupal::service('http_client');
-    $response = $http_client->post($url, ['headers' => $headers, 'body' => $data]);
+    $response = $this->http_client->post($url, ['headers' => $headers, 'body' => $data]);
 
     $this->client->handleAuthResponse($response);
 
-    return new RedirectResponse(\Drupal::url('salesforce.authorize', [], ['absolute' => TRUE]));
+    return new RedirectResponse(Url::fromRoute('salesforce.authorize', [], ['absolute' => TRUE]));
   }
 
 }
diff --git a/src/LoggingTrait.php b/src/LoggingTrait.php
deleted file mode 100644
index 74c1a2fa3ce86ba72819748d3e9b0c47b54fea58..0000000000000000000000000000000000000000
--- a/src/LoggingTrait.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-namespace Drupal\salesforce;
-
-use Psr\Log\LoggerTrait;
-
-/**
- * Provides a trait for Drupal logger wrapper method.
- */
-trait LoggingTrait {
-
-  use LoggerTrait;
-
-  /**
-   * Wrapper method for logging, added for testability
-   *
-   * @param string
-   *   Module name
-   * @param string
-   *   Severity level, see LoggingLevels
-   * @param string
-   *   message, with tokens is appropriate
-   * @param array
-   *   placeholders for tokens, if appriate
-   */
-   protected function log($name, $level, $message, array $placeholders = []) {
-     if (empty($placeholders)) {
-       $placeholders = [];
-     }
-     \Drupal::logger($name)->log($level, $message, $placeholders);
-   }
-
-   /**
-    * Wrapper for watchdog_exception()
-    */
-   protected function watchdogException(\Exception $e) {
-     watchdog_exception(__CLASS__, $e);
-   }
-
-}
diff --git a/src/Rest/RestClient.php b/src/Rest/RestClient.php
index 6923accf35a17009f76097d6d206d3c0ec70ebe4..4895b8f11c3be5d7a213f1f64482421ddbe7d76c 100644
--- a/src/Rest/RestClient.php
+++ b/src/Rest/RestClient.php
@@ -17,7 +17,7 @@ use GuzzleHttp\ClientInterface;
 use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Psr7\Response;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-
+use Drupal\Core\Cache\CacheBackendInterface;
 
 /**
  * Objects, properties, and methods to communicate with the Salesforce REST API.
@@ -31,6 +31,7 @@ class RestClient {
   private $config;
   private $configEditable;
   private $state;
+  protected $cache;
 
   const CACHE_LIFETIME = 300;
 
@@ -42,13 +43,14 @@ class RestClient {
    * @param \Guzzle\Http\ClientInterface $http_client
    *   The config factory.
    */
-  public function __construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, UrlGeneratorInterface $url_generator, StateInterface $state) {
+  public function __construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, UrlGeneratorInterface $url_generator, StateInterface $state, CacheBackendInterface $cache) {
     $this->configFactory = $config_factory;
     $this->httpClient = $http_client;
     $this->urlGenerator = $url_generator;
     $this->config = $this->configFactory->get('salesforce.settings');
     $this->configEditable = $this->configFactory->getEditable('salesforce.settings');
     $this->state = $state;
+    $this->cache = $cache;
     return $this;
   }
 
@@ -425,7 +427,7 @@ class RestClient {
    * @see Drupal\salesforce\Controller\SalesforceController
    */
   public function getAuthCallbackUrl() {
-    return \Drupal::url('salesforce.oauth_callback', [], [
+    return new Url::fromRoute('salesforce.oauth_callback', [], [
       'absolute' => TRUE,
       'https' => TRUE,
     ]);
@@ -470,7 +472,7 @@ class RestClient {
    * @addtogroup salesforce_apicalls
    */
   public function objects(array $conditions = ['updateable' => TRUE], $reset = FALSE) {
-    $cache = \Drupal::cache()->get('salesforce:objects');
+    $cache = $$this->cache->get('salesforce:objects');
 
     // Force the recreation of the cache when it is older than 5 minutes.
     if ($cache && REQUEST_TIME < ($cache->created + self::CACHE_LIFETIME) && !$reset) {
@@ -478,7 +480,7 @@ class RestClient {
     }
     else {
       $result = $this->apiCall('sobjects');
-      \Drupal::cache()->set('salesforce:objects', $result, 0, ['salesforce']);
+      $$this->cache->set('salesforce:objects', $result, 0, ['salesforce']);
     }
 
     if (!empty($conditions)) {
@@ -527,14 +529,14 @@ class RestClient {
       throw new \Exceptionn('No name provided to describe');
     }
 
-    $cache = \Drupal::cache()->get('salesforce:object:' . $name);
+    $cache = $$this->cache->get('salesforce:object:' . $name);
     // Force the recreation of the cache when it is older than 5 minutes.
     if ($cache && REQUEST_TIME < ($cache->created + self::CACHE_LIFETIME) && !$reset) {
       return $cache->data;
     }
     else {
       $response = new RestResponse_Describe($this->apiCall("sobjects/{$name}/describe", [], 'GET', TRUE));
-      \Drupal::cache()->set('salesforce:object:' . $name, $response, 0, ['salesforce']);
+      $$this->cache->set('salesforce:object:' . $name, $response, 0, ['salesforce']);
       return $response;
     }
   }
@@ -760,7 +762,7 @@ class RestClient {
    *   Otherwise, an array of record type arrays, indexed by object type name.
    */
   public function getRecordTypes($name = NULL) {
-    $cache = \Drupal::cache()->get('salesforce:record_types');
+    $cache = $$this->cache->get('salesforce:record_types');
 
     // Force the recreation of the cache when it is older than CACHE_LIFETIME
     if ($cache && REQUEST_TIME < ($cache->created + self::CACHE_LIFETIME) && !$reset) {
@@ -774,7 +776,7 @@ class RestClient {
       foreach ($result->records() as $rt) {
         $record_types[$rt->field('SobjectType')][$rt->field('DeveloperName')] = $rt;
       }
-      \Drupal::cache()->set('salesforce:record_types', $record_types, 0, ['salesforce']);
+      $$this->cache->set('salesforce:record_types', $record_types, 0, ['salesforce']);
     }
 
     if ($name != NULL) {