diff --git a/src/Form/ThemeChangeForm.php b/src/Form/ThemeChangeForm.php
index 05d6f2b..b84197a 100644
--- a/src/Form/ThemeChangeForm.php
+++ b/src/Form/ThemeChangeForm.php
@@ -71,7 +71,7 @@ class ThemeChangeForm extends EntityForm {
     $form['path'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Enter Path'),
-      '#description' => $this->t("Enter Path to change theme. And also Supports wildcards like(user/*, node/*)"),
+      '#description' => $this->t("Enter Path to change theme. And also Supports wildcards like(/user/*, /node/*)"),
       '#states' => [
         'visible' => ['select[name=type]' => ['value' => 'path']],
       ],
@@ -112,6 +112,11 @@ class ThemeChangeForm extends EntityForm {
     if ($type == 'path' && !$path && $route) {
       $form_state->setErrorByName('type', $this->t("Select type as Route"));
     }
+
+    if ($type == 'path' && $path[0] !== '/') {
+      $form_state->setErrorByName('path', t('The path needs to start with a slash.'));
+    }
+
     // If route and path values are not filled.
     if (!$route && !$path) {
       $form_state->setErrorByName('route', $this->t('Route/Path Required'));
diff --git a/src/Theme/ThemeChangeswitcherNegotiator.php b/src/Theme/ThemeChangeswitcherNegotiator.php
index 4de123a..96f5aa4 100644
--- a/src/Theme/ThemeChangeswitcherNegotiator.php
+++ b/src/Theme/ThemeChangeswitcherNegotiator.php
@@ -4,163 +4,128 @@ namespace Drupal\theme_change\Theme;
 
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Theme\ThemeNegotiatorInterface;
+use Drupal\Core\Path\CurrentPathStack;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Path\AliasManager;
+use Drupal\Core\Path\PathMatcher;
+use Drupal\theme_change\Entity\ThemeChange;
 
+/**
+ * Class ThemeChangeswitcherNegotiator.
+ *
+ * @package Drupal\theme_change\Theme
+ */
 class ThemeChangeswitcherNegotiator implements ThemeNegotiatorInterface {
 
-  public function applies(RouteMatchInterface $route_match) {
-    $wildcard = FALSE;
-    $applies = FALSE;
-    // Get Current Path.
-    $current_path = \Drupal::service('path.current')->getPath();
-    // Get Alias of path.
-    $pathAlias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
-    // Get Current Route name.
-    $route_name = \Drupal::routeMatch()->getRouteName();
-    // Get All route names.
-    $routes = $this->_get_route_names();
-    // Get all path values.
-    $paths = $this->_get_path_values();
-    // Get all wildcard path values.
-    $wildcard_paths = $this->_get_path_wildcard_values();
-    foreach ($wildcard_paths as $wildcard_path) {
-      $path_matches = \Drupal::service('path.matcher')->matchPath($current_path, $wildcard_path);
-      if ($path_matches) {
-        $wildcard = TRUE;
-      }
-    }
-    if ($routes && in_array($route_name, $routes)) {
-      $applies = TRUE;
-    }
-    else if ($paths && (in_array($current_path, $paths) || in_array($pathAlias, $paths))) {
-      $applies = TRUE;
-    }
-    else if ($wildcard) {
-      $applies = TRUE;
-    }
-    // Use this theme negotiator.
-    return $applies;
-  }
+  /**
+   * @var \Drupal\theme_change\Entity\ThemeChange
+   */
+  protected $themeChange;
 
   /**
-   * {@inheritdoc}
+   * @var string
    */
-  public function determineActiveTheme(RouteMatchInterface $route_match) {
-    $current_path = \Drupal::service('path.current')->getPath();
-    // Get Alias of path.
-    $pathAlias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
-    // Get Current Route name.
-    $route_name = \Drupal::routeMatch()->getRouteName();
-    // Get All route names.
-    $routes = $this->_get_route_names();
-    // Get all path values.
-    $paths = $this->_get_path_values(); // Get all wildcard path values.
-    $wildcard_paths = $this->_get_path_wildcard_values();
-    foreach ($wildcard_paths as $wildcard_path) {
-      $path_matches = \Drupal::service('path.matcher')->matchPath($current_path, $wildcard_path);
-      if ($path_matches) {
-        $wildcard = TRUE;
-        $wildcard_theme = $wildcard_path;
-        break;
-      }
-    }
-    if ($routes && in_array($route_name, $routes)) {
-      $theme = $this->_get_theme($route_name);
-      return $theme;
-    }
-    else if ($paths && (in_array($current_path, $paths) || in_array($pathAlias, $paths))) {
-      if ($current_path) {
-        $theme = $this->_get_theme($current_path);
-        return $theme;
-      }
-      elseif ($pathAlias) {
-        $theme = $this->_get_theme($current_path);
-        return $theme;
-      }
-    }
-    else if ($wildcard && $wildcard_theme) {
-      $theme = $this->_get_theme($wildcard_theme);
-      return $theme;
-    }
-  }
+  protected $currentPath;
 
   /**
-   * Get all route name(s).
+   * @var string
    */
-  public function _get_route_names() {
-    $routes = [];
-    $route_check = \Drupal::entityQuery('theme_change')
-        ->execute();
-    $entity = \Drupal::entityTypeManager()->getStorage('theme_change');
-    foreach ($route_check as $value) {
-      $entity_load = $entity->load($value);
-      if ($entity_load->get_route()) {
-        $routes[$entity_load->get_route()] = $entity_load->get_route();
-      }
-    }
-    return isset($routes) ? $routes : null;
-  }
+  protected $currentPathAlias;
 
   /**
-   * Get all path value(s).
+   * @var string
    */
-  public function _get_path_values() {
-    $paths = [];
-    $path_check = \Drupal::entityQuery('theme_change')
-        ->execute();
-    $entity = \Drupal::entityTypeManager()->getStorage('theme_change');
-    foreach ($path_check as $value) {
-      $entity_load = $entity->load($value);
-      if ($entity_load->get_path()) {
-        $paths[$entity_load->get_path()] = $entity_load->get_path();
-      }
-    }
-    return isset($paths) ? $paths : null;
+  protected $currentRoute;
+
+  protected $pathMatcher;
+
+  /**
+   * @var EntityTypeManagerInterface
+   */
+  protected $entityTypeManager;
+
+  public static function create(
+    $current_path,
+    $alias_manager,
+    $path_matcher,
+    $current_route_match,
+    $entity_type_manager
+  ) {
+    return new static($current_path, $alias_manager, $path_matcher, $current_route_match, $entity_type_manager);
+  }
+
+  public function __construct(
+    CurrentPathStack $current_path,
+    AliasManager $alias_manager,
+    PathMatcher $path_matcher,
+    RouteMatchInterface $current_route_match,
+    EntityTypeManagerInterface $entity_type_manager
+  ) {
+    // Set Current Path.
+    $this->currentPath = $current_path->getPath();
+
+    // Set Alias of path.
+    $this->currentPathAlias = $alias_manager->getAliasByPath($this->currentPath);
+
+    // Set Current Route name.
+    $this->currentRoute = $current_route_match->getRouteName();
+
+    // Set Path Matcher.
+    $this->pathMatcher = $path_matcher;
+
+    $this->entityTypeManager = $entity_type_manager;
   }
 
   /**
-   * Get all wildcard path value(s).
+   * {@inheritdoc}
    */
-  public function _get_path_wildcard_values() {
-    $paths = [];
-    $path_check = \Drupal::entityQuery('theme_change')
-        ->execute();
-    $entity = \Drupal::entityTypeManager()->getStorage('theme_change');
-    foreach ($path_check as $value) {
-      $entity_load = $entity->load($value);
-      $path = $entity_load->get_path();
-      if ($path) {
-        if ((strpos($path, '/*') !== false) || (strpos($path, '/%') !== false)) {
-          $paths[$entity_load->get_path()] = $entity_load->get_path();
+  public function applies(RouteMatchInterface $route_match) {
+    if ($this->entityTypeManager->hasHandler('theme_change', 'list_builder')) {
+
+      $storage = $this->entityTypeManager->getStorage('theme_change');
+      $entities = $storage->loadMultiple();
+
+      /** @var \Drupal\theme_change\Entity\ThemeChange $entity */
+      foreach ($entities as $entity) {
+        if($this->check($entity)) {
+          $this->themeChange = $entity;
+          return TRUE;
         }
       }
     }
-    return $paths;
+
+    return FALSE;
   }
 
   /**
-   * Get theme based on path/route.
+   * {@inheritdoc}
    */
-  public function _get_theme($value) {
-    $path_check = \Drupal::entityQuery('theme_change')
-        ->condition('path', $value)
-        ->execute();
-    if ($path_check) {
-      $entity = \Drupal::entityTypeManager()->getStorage('theme_change');
-      $entity_load = $entity->load(key($path_check));
-      $path = $entity_load->get_theme();
-      return $path;
-    }
-    else {
-      $route_check = \Drupal::entityQuery('theme_change')
-          ->condition('route', $value)
-          ->execute();
-      if ($route_check) {
-        $entity = \Drupal::entityTypeManager()->getStorage('theme_change');
-        $entity_load = $entity->load(key($route_check));
-        $path = $entity_load->get_theme();
-        return $path;
+  public function determineActiveTheme(RouteMatchInterface $route_match) {
+    return $this->themeChange->get_theme();
+  }
+
+  /**
+   * @param $entity
+   * @return bool
+   */
+  public function check(ThemeChange $entity) {
+    if ($entity->get_type() == 'path') {
+      $all_path = explode(',', $entity->get_path());
+
+      foreach (array_map('trim', $all_path) as $path) {
+        $path_match = $this->pathMatcher->matchPath($this->currentPath, $path);
+        $path_alias_match = $this->pathMatcher->matchPath($this->currentPathAlias, $path);
+
+        if ($path_match || $path_alias_match) {
+          return TRUE;
+        }
       }
     }
+    else if ($entity->get_type() == 'route' && $this->currentRoute == $entity->get_route()) {
+      return TRUE;
+    }
+
+    return FALSE;
   }
 
 }
diff --git a/theme_change.info.yml b/theme_change.info.yml
index 642edfb..b6ed108 100644
--- a/theme_change.info.yml
+++ b/theme_change.info.yml
@@ -3,7 +3,7 @@ type: module
 description: Changes admin theme for selected pages.
 # core: 8.x
 package: Other
-configure: theme_change.paths
+configure: entity.theme_change.collection
 
 # Information added by Drupal.org packaging script on 2017-10-05
 version: '8.x-1.6'
diff --git a/theme_change.services.yml b/theme_change.services.yml
index 0ffc11b..a903385 100644
--- a/theme_change.services.yml
+++ b/theme_change.services.yml
@@ -1,5 +1,6 @@
 services:
   theme.negotiator.theme_change_themeswitcher:
     class: Drupal\theme_change\Theme\ThemeChangeswitcherNegotiator
+    arguments: ['@path.current', '@path.alias_manager', '@path.matcher', '@current_route_match', '@entity_type.manager']
     tags:
       - { name: theme_negotiator, priority: 10 }
\ No newline at end of file
