diff --git a/nodeorder.info.yml b/nodeorder.info.yml
index 5b021e7..3b20d9d 100644
--- a/nodeorder.info.yml
+++ b/nodeorder.info.yml
@@ -1,6 +1,6 @@
 name: 'Node Order'
 description: 'Allows the ordering of nodes within taxonomy terms.'
-core: 8.x
+core_version_requirement: ^8.7.7 || ^9
 configure: nodeorder.admin
 dependencies:
   - drupal:node
diff --git a/nodeorder.install b/nodeorder.install
index fa397f4..a76cf45 100644
--- a/nodeorder.install
+++ b/nodeorder.install
@@ -28,7 +28,7 @@ function nodeorder_install() {
   $keys['fields']['weight'] = $spec;

   // Add the column to the table.
-  db_add_field('taxonomy_index', 'weight', $spec, $keys);
+  \Drupal::database()->schema()->addField('taxonomy_index', 'weight', $spec, $keys);

   // Set the weight of the nodeorder module ensure that nodeorder can alter
   // forms after the taxonomy module.
@@ -41,6 +41,8 @@ function nodeorder_install() {
  * Drops field 'weight' from core table 'taxonomy_index'.
  */
 function nodeorder_uninstall() {
-  db_drop_index('taxonomy_index', 'weight');
-  db_drop_field('taxonomy_index', 'weight');
+  $schema = \Drupal::database()->schema();
+
+  $schema->dropIndex('taxonomy_index', 'weight');
+  $schema->dropField('taxonomy_index', 'weight');
 }
diff --git a/nodeorder.module b/nodeorder.module
index 25236f4..5fe4cee 100755
--- a/nodeorder.module
+++ b/nodeorder.module
@@ -9,7 +9,6 @@ use Drupal\Core\Cache\Cache;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
 use Drupal\node\NodeInterface;
-use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\taxonomy\Entity\Term;
@@ -40,7 +39,7 @@ function nodeorder_entity_operation(EntityInterface $entity) {
   if ($entity instanceof Term) {
     /** @var \Drupal\nodeorder\NodeOrderManagerInterface $nodeorder_manager */
     $nodeorder_manager = \Drupal::service('nodeorder.manager');
-    if ($nodeorder_manager->vocabularyIsOrderable($entity->getVocabularyId())) {
+    if ($nodeorder_manager->vocabularyIsOrderable($entity->bundle())) {
       $operations['order'] = [
         'title' => t('Order'),
         'query' => \Drupal::destination()->getAsArray(),
@@ -90,9 +89,10 @@ function nodeorder_taxonomy_vocabulary_form_submit($form, FormStateInterface $fo
   $nodeorder_manager = \Drupal::service('nodeorder.manager');

   $vocabulary = $form_state->getFormObject()->getEntity();
-  $config = \Drupal::configFactory()->getEditable('nodeorder.settings');
+  $config = \Drupal::service('config.nodeorder_settings');
   $orderable = $form_state->getValue('orderable');
   $vocabularies = $config->get('vocabularies');
+  $term_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');

   if ($orderable && empty($vocabularies[$vocabulary->id()])) {
     // Switching from non-orderable to orderable.
@@ -100,7 +100,7 @@ function nodeorder_taxonomy_vocabulary_form_submit($form, FormStateInterface $fo

     // Set weight to nid for all rows in term_node where the tid is in this
     // vocabulary.
-    $tree = \Drupal::service('entity_type.manager')->getStorage("taxonomy_term")->loadTree($vocabulary->id());
+    $tree = $term_storage->loadTree($vocabulary->id());
     $tids = [];
     foreach ($tree as $term) {
       $tids[] = $term->tid;
@@ -139,7 +139,7 @@ function nodeorder_taxonomy_vocabulary_form_submit($form, FormStateInterface $fo

     // Set weight to 0 for all rows in term_node where the tid is in this
     // vocabulary.
-    $tree = \Drupal::service('entity_type.manager')->getStorage("taxonomy_term")->loadTree($vocabulary->id());
+    $tree = $term_storage->loadTree($vocabulary->id());
     $tids = [];
     foreach ($tree as $term) {
       $tids[] = $term->tid;
diff --git a/nodeorder.services.yml b/nodeorder.services.yml
index a6729a1..190c647 100755
--- a/nodeorder.services.yml
+++ b/nodeorder.services.yml
@@ -6,4 +6,4 @@ services:

   nodeorder.manager:
     class: Drupal\nodeorder\NodeOrderManager
-    arguments: ['@config.factory', '@entity.manager', '@cache.default']
+    arguments: ['@config.nodeorder_settings', '@database', '@entity_type.manager', '@cache.default']
diff --git a/src/Access/NodeOrderAccess.php b/src/Access/NodeOrderAccess.php
index c5b6b73..32f654e 100644
--- a/src/Access/NodeOrderAccess.php
+++ b/src/Access/NodeOrderAccess.php
@@ -62,12 +62,13 @@ class NodeOrderAccess implements ContainerInjectionInterface {
    * Vocabulary orderable.
    *
    * @param \Drupal\taxonomy\Entity\Term $taxonomy_term
+   *   Taxonomy term.
    *
    * @return \Drupal\Core\Access\AccessResult
    *   Access result.
    */
   public function isVocabularyOrderable(Term $taxonomy_term) {
-    $vocabulary_id = $taxonomy_term->getVocabularyId();
+    $vocabulary_id = $taxonomy_term->bundle();

     return $this->nodeOrderManager->vocabularyIsOrderable($vocabulary_id)
       ? AccessResult::allowed()
@@ -78,6 +79,7 @@ class NodeOrderAccess implements ContainerInjectionInterface {
    * Administer order.
    *
    * @param \Drupal\taxonomy\Entity\Term $taxonomy_term
+   *   Taxonomy term.
    *
    * @return \Drupal\Core\Access\AccessResult
    *   Access result.
diff --git a/src/Form/NodeorderAdminForm.php b/src/Form/NodeorderAdminForm.php
index bb952d2..8770ff4 100644
--- a/src/Form/NodeorderAdminForm.php
+++ b/src/Form/NodeorderAdminForm.php
@@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface;
 class NodeorderAdminForm extends ConfigFormBase {

   /**
-   * {@inheritdoc}.
+   * {@inheritdoc}
    */
   public function getFormId() {
     return 'nodeorder_admin';
diff --git a/src/NodeOrderListBuilder.php b/src/NodeOrderListBuilder.php
index d180c79..dc70d79 100644
--- a/src/NodeOrderListBuilder.php
+++ b/src/NodeOrderListBuilder.php
@@ -134,9 +134,10 @@ class NodeOrderListBuilder extends EntityListBuilder implements FormInterface {

     $this->entitiesCount = (int) $count_query->execute()->fetchField();

-    // Method load will be triggered later, if we pass empty array as an argument,
-    // method will be load all entities with type node, will be passed -1 as an
-    // allowed ID for node to prevent loading all entities.
+    // Method load will be triggered later, if we pass empty array as
+    // an argument, method will be load all entities with type node,
+    // will be passed -1 as an allowed ID for node to prevent loading
+    // all entities.
     // Case for term without nodes.
     return $this->nodesWeight ? array_keys($this->nodesWeight) : [-1];
   }
diff --git a/src/NodeOrderManager.php b/src/NodeOrderManager.php
index 4dbc209..1e2f236 100644
--- a/src/NodeOrderManager.php
+++ b/src/NodeOrderManager.php
@@ -3,10 +3,11 @@
 namespace Drupal\nodeorder;

 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Config\Config;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\node\NodeInterface;
 use Drupal\taxonomy\Entity\Vocabulary;
-use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Cache\CacheBackendInterface;

 /**
@@ -15,11 +16,19 @@ use Drupal\Core\Cache\CacheBackendInterface;
 class NodeOrderManager implements NodeOrderManagerInterface {

   /**
-   * The configuration object factory.
+   * The configuration object.
    *
-   * @var \Drupal\Core\Config\ConfigFactoryInterface
+   * @var \Drupal\Core\Config\Config
    */
-  protected $configFactory;
+  protected $config;
+
+  /**
+   * The current database connection.
+   *
+   * @var \Drupal\Core\Database\Connection
+   */
+  protected $database;
+

   /**
    * Taxonomy term storage.
@@ -38,16 +47,21 @@ class NodeOrderManager implements NodeOrderManagerInterface {
   /**
    * Constructs a NodeOrderManager object.
    *
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
-   *   The configuration object factory.
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   * @param \Drupal\Core\Config\Config $config
+   *   The configuration object.
+   * @param \Drupal\Core\Database\Connection $database
+   *   The current database connection.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    *   The entity manager.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache
    *   Default cache bin.
+   *
+   * @throws \Throwable
    */
-  public function __construct(ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, CacheBackendInterface $cache) {
-    $this->configFactory = $config_factory;
-    $this->termStorage = $entity_manager->getStorage('taxonomy_term');
+  public function __construct(Config $config, Connection $database, EntityTypeManagerInterface $entity_type_manager, CacheBackendInterface $cache) {
+    $this->database = $database;
+    $this->config = $config;
+    $this->termStorage = $entity_type_manager->getStorage('taxonomy_term');
     $this->cache = $cache;
   }

@@ -57,7 +71,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
   public function addToList(NodeInterface $node, $tid) {
     // Append new orderable node. Get the cached weights.
     $weights = $this->getTermMinMax($tid);
-    \Drupal::database()->update('taxonomy_index')
+    $this->database->update('taxonomy_index')
       ->fields(['weight' => $weights['min'] - 1])
       ->condition('nid', $node->id())
       ->condition('tid', $tid)
@@ -65,7 +79,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
     // If new node out of range, push top nodes down filling the order gap
     // this is when old list's min weight is top range
     // except when new orderable node increases range (new list is not even).
-    $taxonomy_nids = \Drupal::database()->select('taxonomy_index', 'ti')
+    $taxonomy_nids = $this->database->select('taxonomy_index', 'ti')
       ->fields('ti', ['nid'])
       ->condition('ti.tid', $tid)
       ->orderBy('ti.weight')
@@ -79,7 +93,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
       $top_range_nids = [];
       $previous_weight = $weights['min'] - 2;
       foreach ($taxonomy_nids as $taxonomy_nid) {
-        $taxonomy_node_weight = \Drupal::database()->select('taxonomy_index', 'i')
+        $taxonomy_node_weight = $this->database->select('taxonomy_index', 'i')
           ->fields('i', ['weight'])
           ->condition('tid', $tid)
           ->condition('nid', $taxonomy_nid)
@@ -93,7 +107,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
         $top_range_nids[] = $taxonomy_nid;
       }
       // Move top nodes down.
-      $query = \Drupal::database()->update('taxonomy_index');
+      $query = $this->database->update('taxonomy_index');
       $query->expression('weight', 'weight + 1');
       $query->condition('nid', $top_range_nids, 'IN')
         ->condition('tid', $tid)
@@ -124,7 +138,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
     }

     if (!isset($min_weights[$tid]) || !isset($max_weights[$tid])) {
-      $query = \Drupal::database()->select('taxonomy_index', 'i')
+      $query = $this->database->select('taxonomy_index', 'i')
         ->fields('i', ['tid'])
         ->condition('tid', $tid)
         ->groupBy('tid');
@@ -146,14 +160,14 @@ class NodeOrderManager implements NodeOrderManagerInterface {
    * {@inheritdoc}
    */
   public function vocabularyIsOrderable($vid) {
-    $vocabularies = $this->configFactory->get('nodeorder.settings')->get('vocabularies');
+    $vocabularies = $this->config->get('vocabularies');
     return !empty($vocabularies[$vid]);
   }

   /**
    * {@inheritdoc}
    */
-  public function selectNodes($tids = [], $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC', $count = -1) {
+  public function selectNodes(array $tids = [], $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC', $count = -1) {
     if (count($tids) > 0) {
       // For each term ID, generate an array of descendant term IDs
       // to the right depth.
@@ -177,7 +191,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
       }
       else {
         $args = [];
-        $query = \Drupal::database()->select('node', 'n');
+        $query = $this->database->select('node', 'n');
         $query->join('node_field_data', 'nd', 'nd.nid = n.nid');
         $query->condition('nd.status', 1);
         foreach ($descendant_tids as $index => $tids) {
@@ -194,21 +208,21 @@ class NodeOrderManager implements NodeOrderManagerInterface {

       if ($pager) {
         if ($count == -1) {
-          $count = $this->configFactory->get('nodeorder.settings')->get('default_nodes_main');
+          $count = $this->config->get('default_nodes_main');
         }
         $result = pager_query($sql, $count, 0, $sql_count, $args);
       }
       else {
         if ($count == -1) {
-          $count = $this->configFactory->get('nodeorder.settings')->get('feed_default_items');
+          $count = $this->config->get('feed_default_items');
         }

         if ($count == 0) {
-          // TODO Please convert this statement to the D7 database API syntax.
+          // @todo: Please convert this statement to the D7 database API syntax.
           $result = $query->execute();
         }
         else {
-          // TODO Please convert this statement to the D7 database API syntax.
+          // @todo: Please convert this statement to the D7 database API syntax.
           $result = db_query_range($sql, $args);
         }
       }
@@ -264,13 +278,13 @@ class NodeOrderManager implements NodeOrderManagerInterface {
     }
     else {
       $vocabularies = [];
-      foreach ($this->configFactory->get('nodeorder.settings')->get('vocabularies') as $vid => $orderable) {
+      foreach ($this->config->get('vocabularies') as $vid => $orderable) {
         if ($orderable) {
           $vocabularies[] = $vid;
         }
       }
       if (!empty($vocabularies)) {
-        $query = \Drupal::database()->select('taxonomy_index', 'i');
+        $query = $this->database->select('taxonomy_index', 'i');
         $query->join('taxonomy_term_data', 'd', 'd.tid = i.tid');
         $query->condition('i.nid', $node->id())
           ->condition('d.vid', $vocabularies, 'IN')
@@ -317,7 +331,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
    * {@inheritdoc}
    */
   public function handleListsDecrease($tid) {
-    $taxonomy_nids = \Drupal::database()->select('taxonomy_index', 'ti')
+    $taxonomy_nids = $this->database->select('taxonomy_index', 'ti')
       ->fields('ti', ['nid'])
       ->condition('ti.tid', $tid)
       ->orderBy('ti.weight')
@@ -334,7 +348,7 @@ class NodeOrderManager implements NodeOrderManagerInterface {
     if ($border_out_of_range) {
       $weight = -$range_border;
       foreach ($taxonomy_nids as $nid) {
-        \Drupal::database()->update('taxonomy_index')
+        $this->database->update('taxonomy_index')
           ->fields(['weight' => $weight])
           ->condition('nid', $nid)
           ->condition('tid', $tid)
   /**
    * Determine if a given node can be ordered in any vocabularies.
diff --git a/tests/src/Functional/NodeorderPermissionsTest.php b/tests/src/Functional/NodeorderPermissionsTest.php
index 849ca50..96ca2f6 100644
--- a/tests/src/Functional/NodeorderPermissionsTest.php
+++ b/tests/src/Functional/NodeorderPermissionsTest.php
@@ -19,6 +19,11 @@ class NodeorderPermissionsTest extends BrowserTestBase {
   }

   /**
+   * {@inheritdoc}
+   */
+  protected $defaultTheme = 'stark';
+
+  /**
    * The configuration factory service.
    *
    * @var \Drupal\Core\Config\ConfigFactoryInterface
