diff --git a/src/Controller/StockApiController.php b/src/Controller/StockApiController.php
index 2d51402..0023e12 100644
--- a/src/Controller/StockApiController.php
+++ b/src/Controller/StockApiController.php
@@ -68,7 +68,9 @@ class StockApiController extends ControllerBase {
       ],
     ];
 
-    $query = db_select('stockapi', 's')->extend('Drupal\Core\Database\Query\PagerSelectExtender')->extend('Drupal\Core\Database\Query\TableSortExtender');
+    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+    $query = \Drupal::database()->select('stockapi', 's')->extend('Drupal\Core\Database\Query\PagerSelectExtender')->extend('Drupal\Core\Database\Query\TableSortExtender');
     $result = $query->fields('s', [
       'symbol',
       'name',
diff --git a/src/Form/StockapiAdminSettings.php b/src/Form/StockapiAdminSettings.php
index 19637ef..aa8aabf 100644
--- a/src/Form/StockapiAdminSettings.php
+++ b/src/Form/StockapiAdminSettings.php
@@ -45,7 +45,7 @@ class StockapiAdminSettings extends ConfigFormBase {
     return ['stockapi.settings'];
   }
 
-  public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
+  public function buildForm(array $form, FormStateInterface $form_state) {
 
     $intervals = [900, 1800, 3600, 21600, 43200, 86400];
 
diff --git a/stockapi.inc b/stockapi.inc
index ffba924..1854bf7 100644
--- a/stockapi.inc
+++ b/stockapi.inc
@@ -51,8 +51,12 @@ function stockapi_fetch($symbols) {
     foreach($stock_array as $stock_symbol) {
       $stock_test = '';
       $stock_name = '';
-      $result = db_query("SELECT exchange FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock_symbol))->fetchField();
-      $resultName = db_query("SELECT name FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock_symbol))->fetchField();
+      // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+      // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+      $result = \Drupal::database()->query("SELECT exchange FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock_symbol))->fetchField();
+      // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+      // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+      $resultName = \Drupal::database()->query("SELECT name FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock_symbol))->fetchField();
       if (empty($result)) {
         $stock_test = 'TSE';
       }
@@ -100,6 +104,8 @@ function stockapi_fetch($symbols) {
         $warning_key = t('Using demo key, please register for a free api key' .
          ' at https://www.alphavantage.co/support/#api-key then set the key ' .
          ' at /admin/config/services/stockapi and press save.');
+        // 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($warning_key, $type = 'warning', $repeat = FALSE);
       }
       $sym = $stock_symbol;
@@ -843,13 +849,16 @@ function stockapi_save($stock) {
   // Fix potential text in float fields.
   $stock = _stockapi_fix_floats($stock);
 
-  if (isset($stock->symbol) && db_query("SELECT symbol FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock->symbol))->fetchField()) {
+  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+  if (isset($stock->symbol) && \Drupal::database()->query("SELECT symbol FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $stock->symbol))->fetchField()) {
     // Update
     $symbol = $stock->symbol;
     $stock = (array) $stock;
     unset($stock['symbol']); // Primary key
-
-    $updated = db_update('stockapi')
+    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+    $updated = \Drupal::database()->update('stockapi')
         ->fields((array) $stock)
         ->condition('symbol', $symbol)
         ->execute();
@@ -858,7 +867,9 @@ function stockapi_save($stock) {
   }
   else {
     //Insert
-    $inserted = db_insert('stockapi')
+    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+    $inserted = \Drupal::database()->insert('stockapi')
         ->fields((array) $stock)
         ->execute();
 
@@ -881,13 +892,13 @@ function stockapi_save($stock) {
 function stockapi_load($symbol, $q = NULL) {
   static $stocks = array();
 
-  if (!\Drupal\Component\Utility\Unicode::strlen($symbol)) {
+  if (!mb_strlen($symbol)) {
     return array();
   }
 
   if (!isset($stocks[$symbol])) {
     $fields = _stockapi_get_fields($q);
-    $results = db_query("SELECT " . implode(',', $fields) . " FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $symbol), array('fetch' => PDO::FETCH_ASSOC));
+    $results = \Drupal::database()->query("SELECT " . implode(',', $fields) . " FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $symbol), array('fetch' => PDO::FETCH_ASSOC));
     if (count($results)) {
       foreach ($results as $result) {
         $stocks[$symbol] = $result;
@@ -917,7 +928,9 @@ function stockapi_multiload($symbol, $q = NULL) {
   $stocks = array();
   $fields = _stockapi_get_fields($q);
   $symbols = implode(', ', array_map('_stockapi_quote_it', $symbol));
-  $results = db_query("SELECT " . implode(', ', $fields) . " FROM {stockapi} WHERE symbol IN ({$symbols})");
+  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+  $results = \Drupal::database()->query("SELECT " . implode(', ', $fields) . " FROM {stockapi} WHERE symbol IN ({$symbols})");
   foreach ($results as $stock) {
     $stocks[$stock->symbol] = $stock;
   }
@@ -970,7 +983,7 @@ function _stockapi_to_object($stock, $q = NULL) {
       }
     }
   }
-  $s->updated = REQUEST_TIME;
+  $s->updated = \Drupal::time()->getRequestTime();
 
   return $s;
 }
diff --git a/stockapi.module b/stockapi.module
index 4734018..0610358 100644
--- a/stockapi.module
+++ b/stockapi.module
@@ -21,14 +21,16 @@ module_load_include('inc', 'stockapi');
  * Implements hook_cron().
  */
 function stockapi_cron() {
-  if (REQUEST_TIME - \Drupal::config('stockapi.settings')->get('stockapi_fetch_last') >= \Drupal::config('stockapi.settings')->get('stockapi_fetch')) {
+  if (\Drupal::time()->getRequestTime() - \Drupal::config('stockapi.settings')->get('stockapi_fetch_last') >= \Drupal::config('stockapi.settings')->get('stockapi_fetch')) {
     if (intval(\Drupal::config('stockapi.settings')->get('stockapi_fetch_first')) < 1) {
       stockapi_fetch_symbols();
     }
     else {
 
       $symbols = array();
-      $result = db_query('SELECT symbol FROM {stockapi} ORDER BY updated');
+      // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+      // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+      $result = \Drupal::database()->query('SELECT symbol FROM {stockapi} ORDER BY updated');
       if (count($result)) {
     foreach ($result as $data) {
       $symbols[] = $data->symbol;
@@ -36,7 +38,7 @@ function stockapi_cron() {
       }
 
       $default_symbols = \Drupal::config('stockapi.settings')->get('stockapi_default_symbols');
-      if (\Drupal\Component\Utility\Unicode::strlen($default_symbols)) {
+      if (mb_strlen($default_symbols)) {
         $default_symbols_array = explode(' ', $default_symbols);
         $symbols = array_unique(array_merge($default_symbols_array, $symbols));
       }
@@ -47,7 +49,7 @@ function stockapi_cron() {
       stockapi_save(_stockapi_to_object($stock));
     }
     \Drupal::moduleHandler()->invokeAll('stockapi_post_update', [$stocks]);
-    \Drupal::configFactory()->getEditable('stockapi.settings')->set('stockapi_fetch_last', REQUEST_TIME)->save();
+    \Drupal::configFactory()->getEditable('stockapi.settings')->set('stockapi_fetch_last', \Drupal::time()->getRequestTime())->save();
 
     \Drupal::cache()->delete('variables');
   }
@@ -62,7 +64,7 @@ function stockapi_fetch_symbols() {
   if (intval(\Drupal::config('stockapi.settings')->get('stockapi_fetch_first')) < 1) {
     $symbols = array();
     $default_symbols = \Drupal::config('stockapi.settings')->get('stockapi_default_symbols');
-    if (\Drupal\Component\Utility\Unicode::strlen($default_symbols)) {
+    if (mb_strlen($default_symbols)) {
       $symbols = explode(' ', $default_symbols);
     }
     if (!count($symbols)) {
@@ -74,8 +76,8 @@ function stockapi_fetch_symbols() {
       stockapi_save($stock);
     }
     \Drupal::moduleHandler()->invokeAll('stockapi_post_update', [$stocks]);
-    \Drupal::configFactory()->getEditable('stockapi.settings')->set('stockapi_fetch_first', REQUEST_TIME)->save();
-    \Drupal::logger('stockapi')->notice(sprintf("Stock API has successfully loaded all default symbols: %s", strftime('Y-m-d H:i:s', REQUEST_TIME)), []);
+    \Drupal::configFactory()->getEditable('stockapi.settings')->set('stockapi_fetch_first', \Drupal::time()->getRequestTime())->save();
+    \Drupal::logger('stockapi')->notice(sprintf("Stock API has successfully loaded all default symbols: %s", strftime('Y-m-d H:i:s', \Drupal::time()->getRequestTime())), []);
   }
 }
 
@@ -88,7 +90,9 @@ function stockapi_fetch_symbols() {
  */
 function stockapi_format_symbol($field, $title = '', $exchange = NULL) {
   if (empty($exchange)) {
-    $result = db_query("SELECT exchange FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $field))->fetchField();
+    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+    $result = \Drupal::database()->query("SELECT exchange FROM {stockapi} WHERE symbol = :symbol", array(':symbol' => $field))->fetchField();
     if (empty($result)) {
       $exchange = 'TSE';
     }
@@ -123,7 +127,7 @@ function stockapi_format_symbol($field, $title = '', $exchange = NULL) {
     break;
   }
 
-  $options = ['query' => ['q' => $exchange . ':' . $field], 'attributes' => ['target' => '_blank', 'title' => (Unicode::strlen($title)) ? $title : $field]];
+  $options = ['query' => ['q' => $exchange . ':' . $field], 'attributes' => ['target' => '_blank', 'title' => (mb_strlen($title)) ? $title : $field]];
   $url = Url::fromUri('http://finance.google.com/finance', $options);
   $link = Link::fromTextAndUrl(Unicode::strtoupper($field), $url);
   return $link;
