diff --git a/src/Controller/UCWishlistController.php b/src/Controller/UCWishlistController.php
index f7647af..9eb50ac 100644
--- a/src/Controller/UCWishlistController.php
+++ b/src/Controller/UCWishlistController.php
@@ -6,38 +6,60 @@ use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\user\Entity\User;
-use Drupal\uc_wishlist\Database;
+use Drupal\uc_wishlist\Database\UcWishlistManager;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
+/**
+ *
+ */
 class UCWishlistController extends ControllerBase {
 
-  protected $db;
+  /**
+   * @var \Drupal\uc_wishlist\Database\UcWishlistManager
+   */
+  protected $wishlistManager;
 
   /**
+   * Constructs a UCWishlistController object.
    *
+   * @param \Drupal\uc_wishlist\Database\UcWishlistManager $wishlist_manager
+   */
+  public function __construct(UcWishlistManager $wishlist_manager) {
+    $this->wishlistManager = $wishlist_manager;
+  }
+
+  /**
+   * {@inheritdoc}
    */
-  public function __construct() {
-    $this->db = new Database\DBQuery(\Drupal::database());
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('uc_wishlist.manager')
+    );
   }
 
   /**
+   * This function returns a list of user wish lists by displaying
+   * the user, title and expiration status.
    *
+   * @return array
+   *   a paged list of wish lists.
    */
   public function AdminWishlist() {
     $rows = [];
 
     $header = [
             [
-                'data' => t('User'),
-                'field' => 'u.name',
-                'sort' => 'asc',
+              'data' => t('User'),
+              'field' => 'u.name',
+              'sort' => 'asc',
             ],
             [
-                'data' => t('Title'),
-                'field' => 'w.title',
+              'data' => t('Title'),
+              'field' => 'w.title',
             ],
             [
-                'data' => t('Expiration date'),
-                'field' => 'w.expiration',
+              'data' => t('Expiration date'),
+              'field' => 'w.expiration',
             ],
             ['data' => t('Status')],
     ];
@@ -53,13 +75,13 @@ class UCWishlistController extends ControllerBase {
       ];
       $deleteUrl->setOptions($link_options);
 
-      //wishlist expiration status
+      // Wishlist expiration status.
       $expired = '';
       if ($wishlist->expiration < REQUEST_TIME) {
         $expired = t('Expired');
       }
-      elseif($wishlist->expiration > 0) {
-         $expired = t('Active');
+      elseif ($wishlist->expiration > 0) {
+        $expired = t('Active');
       }
       $deleteUrl = Link::fromTextAndUrl($expired . ' | Delete', $deleteUrl)->toString();
       $account = User::load($wishlist->uid);
@@ -69,22 +91,22 @@ class UCWishlistController extends ControllerBase {
         Link::fromTextAndUrl($wishlist->title, Url::fromRoute('uc_wishlist.wishlist_view', ['wid' => $wishlist->wid]))->toString(),
         \Drupal::service('date.formatter')->format($wishlist->expiration),
         $deleteUrl,
-        ];
+      ];
     }
 
-      if (empty($rows)) {
-        $rows[] = [
+    if (empty($rows)) {
+      $rows[] = [
           [
             'data'    => t('No wish lists found'),
             'colspan' => 4,
           ],
-        ];
-      }
-      return [
-            '#theme' => 'table',
-            '#header' => $header,
-            '#rows' => $rows
       ];
+    }
+    return [
+      '#theme' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+    ];
   }
 
   /**
@@ -100,7 +122,7 @@ class UCWishlistController extends ControllerBase {
     if (!$own && $wid == uc_wishlist_get_wid()) {
       return $this->redirect('uc_wishlist.wishlist');
     }
-    // load the wish list.
+    // Load the wish list.
     $wishlist = uc_wishlist_load($wid);
 
     // Handle a non-existent wish list.
@@ -110,28 +132,28 @@ class UCWishlistController extends ControllerBase {
       drupal_set_message($this->t('The wish list you requested could not be found. Perhaps you can try looking for it through the wish list search form below.'));
       return $this->redirect('uc_wishlist.wishlist.search');
     }
-    // Display only if the users wishlist is not set to private
+    // Display only if the users wishlist is not set to private.
     if (!$wishlist->private) {
 
-      //Set the title to the wishlist title
+      // Set the title to the wishlist title.
       $title = $wishlist->title;
-      //adding expiration info to display
+      // Adding expiration info to display.
       if ($wishlist->expiration < REQUEST_TIME) {
-        $output .= '<p>' . $this->t('This wish list may no longer be valid. It was for an event on @date.', array('@date' => \Drupal::service('date.formatter')->format($wishlist->expiration))) . '</p>';
+        $output .= '<p>' . $this->t('This wish list may no longer be valid. It was for an event on @date.', ['@date' => \Drupal::service('date.formatter')->format($wishlist->expiration)]) . '</p>';
       }
       elseif ($wishlist->expiration > 0) {
-        $output .= '<p>' . $this->t('This wish list is valid until @date.', array('@date' => \Drupal::service('date.formatter')->format($wishlist->expiration))) . '</p>';
+        $output .= '<p>' . $this->t('This wish list is valid until @date.', ['@date' => \Drupal::service('date.formatter')->format($wishlist->expiration)]) . '</p>';
       }
 
       $items = uc_wishlist_get_contents($wid);
 
       if (empty($items)) {
-        //@TODO: add the users name to the output string
+        // @TODO: add the users name to the output string
         $output = '<p>There are no products in this wish list.</p>';
-        //return $render;
+        // Return $render;.
       }
       else {
-        $form = \Drupal::formBuilder()->getForm('Drupal\uc_wishlist\Form\WishlistViewForm', $items, $wid, false);
+        $form = \Drupal::formBuilder()->getForm('Drupal\uc_wishlist\Form\WishlistViewForm', $items, $wid, FALSE);
         $rendered_wishlistview_form = \Drupal::service('renderer')->render($form);
       }
     }
@@ -153,9 +175,9 @@ class UCWishlistController extends ControllerBase {
    *
    */
   public function myWishlist() {
-    //setup our render array for all our page variables and configurations
+    // Setup our render array for all our page variables and configurations.
     $render = [];
-    //get the wishlist id based off of the current users id
+    // Get the wishlist id based off of the current users id.
     $wid = uc_wishlist_get_wid();
     // Attempt to load the wish list.
     $wishlist = uc_wishlist_load($wid);
@@ -170,12 +192,12 @@ class UCWishlistController extends ControllerBase {
     }
     $title = 'My Wish List';
 
-    //Adding expiration info to display
+    // Adding expiration info to display.
     if ($wishlist->expiration < REQUEST_TIME) {
-      $output .= '<p>' . $this->t('This wish list may no longer be valid. It was for an event on @date.', array('@date' => \Drupal::service('date.formatter')->format($wishlist->expiration))) . '</p>';
+      $output .= '<p>' . $this->t('This wish list may no longer be valid. It was for an event on @date.', ['@date' => \Drupal::service('date.formatter')->format($wishlist->expiration)]) . '</p>';
     }
     elseif ($wishlist->expiration > 0) {
-      $output .= '<p>' . $this->t('This wish list is valid until @date.', array('@date' => \Drupal::service('date.formatter')->format($wishlist->expiration))) . '</p>';
+      $output .= '<p>' . $this->t('This wish list is valid until @date.', ['@date' => \Drupal::service('date.formatter')->format($wishlist->expiration)]) . '</p>';
     }
 
     $items = uc_wishlist_get_contents($wid);
@@ -185,7 +207,7 @@ class UCWishlistController extends ControllerBase {
       return $render;
     }
 
-    $form = \Drupal::formBuilder()->getForm('Drupal\uc_wishlist\Form\WishlistViewForm', $items, $wid, true);
+    $form = \Drupal::formBuilder()->getForm('Drupal\uc_wishlist\Form\WishlistViewForm', $items, $wid, TRUE);
     $rendered_wishlistview_form = \Drupal::service('renderer')->render($form);
     $render['#theme'] = 'uc_wishlist_view_wishlist';
     $render['#type'] = 'theme';
@@ -196,7 +218,6 @@ class UCWishlistController extends ControllerBase {
     return $render;
   }
 
-
   /**
    *
    */
@@ -204,6 +225,4 @@ class UCWishlistController extends ControllerBase {
     return [];
   }
 
-
-
 }
diff --git a/src/Database/DBQuery.php b/src/Database/DBQuery.php
deleted file mode 100644
index 10ea39f..0000000
--- a/src/Database/DBQuery.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-
-namespace Drupal\uc_wishlist\Database;
-
-use Drupal\Core\Database\Connection;
-
-class DBQuery {
-
-  protected $connection;
-
-  /**
-   *
-   */
-  public function __construct(Connection $connection) {
-    $this->connection = $connection;
-  }
-
-  public function getAllWishlist()   {
-    $query = $this->connection->select('uc_wishlists', 'w');
-    $query->leftJoin('users', 'u', 'w.uid = u.uid');
-    $query->fields('w', [
-      'wid',
-      'uid',
-      'title',
-      'expiration',
-    ]);
-    $result = $query->execute();//$query->extend('PagerDefault')->limit(25)->execute();
-    return $result;
-  }
-
-  /**
-   *
-   */
-  public function createWishlist($fields,$values) {
-    return $query = $this->connection->insert('uc_wishlists')->fields($fields,$values)->execute();
-  }
-
-  /**
-   *
-   */
-  public function createWishlistProduct($fields,$values) {
-    return $query = $this->connection->insert('uc_wishlist_products')->fields($fields,$values)->execute();
-  }
-
-  /**
-   *
-   */
-  public function getWishlistIdByUser($uid) {
-    $query = $this->connection->query("SELECT wid FROM {uc_wishlists} WHERE uid = :uid", [':uid' => $uid])->fetchField();
-    return $query;
-  }
-
-  /**
-   *
-   */
-  public function getWishlistItem($wid, $nid,$data) {
-    $query = $this->connection->query("SELECT * FROM {uc_wishlist_products} WHERE wid = :wid AND nid = :nid AND data = :data", [':wid' => $wid, ':nid' => $nid, ':data' => serialize($data)]);
-    return $query->fetchObject();
-  }
-
-  /**
-   *
-   */
-  public function searchUserWishlist($keywords) {
-    if (!empty($keywords)) {
-      // Check for user, wish list title, or address matches.
-      $query = $this->connection->select('uc_wishlists', 'w');
-      $query->join('users', 'u', 'w.uid = u.uid');
-      $query->fields('w', [
-          'wid',
-          'title',
-      ]);
-      $query->distinct();
-      $query->condition(db_or()
-        ->condition('u.name', '%' . $keywords . '%', 'LIKE')
-        ->condition('w.title', '%' . $keywords . '%', 'LIKE')
-        ->condition('w.address', '%' . $keywords . '%', 'LIKE'));
-    }
-    else {
-      $query = $this->connection->select('uc_wishlists', 'w');
-      $query->fields('w', [
-        'wid',
-        'title',
-      ]);
-    }
-    $query->condition('w.private', 0, '=');
-    $result = $query->orderBy('w.title')->execute; // $query->extend('PagerDefault')->limit(25)->execute();
-    return $result;
-  }
-
-  /**
-   *
-   */
-  public function getWishlist($wid) {
-    $query = $this->connection->query("SELECT * FROM {uc_wishlists} WHERE wid = :wid", [':wid' => $wid]);
-    return $query;
-  }
-
-  public function selectAccounts($rid,$created) {
-    $query = $this->connection->select('users','u');
-    $query->innerJoin('user_roles','ur','u.uid = ur.uid');
-    $query->where('ur.rid = :rid AND u.created < :created', [
-      ':rid' => $rid,
-      ':created' => $created,
-    ]);
-    return $query->execute();
-  }
-
-  public function selectWishlistProducts($wid) {
-    $query = $this->connection->select('node','n');
-    $query->join('uc_wishlist_products', 'w', 'n.nid = w.nid');
-    $query->fields('w');
-    $query->addField('n', 'vid');
-    $query->condition('w.wid', $wid);
-    $query->addTag('node_access');
-    $query->join('node_field_data','f', 'n.nid = f.nid');
-    $query->addField('f', 'title');
-
-    $result = $query->execute();
-    return $result;
-  }
-
-  /**
-   *
-   */
-  public function updateWantedQuantity($wpid,$qty) {
-    $this->connection->update('uc_wishlist_products')->fields(['qty'=>$qty])->condition('wpid',$wpid,'=')->execute();
-  }
-
-  /**
-   *
-   */
-  public function deleteWishlist($wid) {
-    $this->connection->delete('uc_wishlists')->condition('wid', $wid)->execute();
-    $this->connection->delete('uc_wishlist_products')->condition('wid', $wid)->execute();
-  }
-
-  /**
-   *
-   */
-  public function isProductInWishlist($wid,$pid) {
-    $query = $this->connection->query("SELECT * FROM {uc_wishlist_products} WHERE nid = :pid AND wid = :wid", [':pid'=>$pid,':wid'=>$wid]);
-    return $query->fetchAll();
-  }
-
-  /**
-   *
-   */
-  public function remove_item($wpid) {
-    $this->connection->delete('uc_wishlist_products')->condition('wpid', $wpid)->execute();
-  }
-
-  /**
-   *
-   */
-  public function remove_product($pid) {
-    $this->connection->delete('uc_wishlist_products')->condition('nid',$pid)->execute();
-  }
-
-  public function queryExamples() {
-    $this->connection->query(" ... ");
-    $this->connection->select(" ... ");
-  }
-}
diff --git a/src/Database/UcWishlistManager.php b/src/Database/UcWishlistManager.php
new file mode 100644
index 0000000..93b2962
--- /dev/null
+++ b/src/Database/UcWishlistManager.php
@@ -0,0 +1,318 @@
+<?php
+
+namespace Drupal\uc_wishlist\Database;
+
+use Drupal\Core\Database\Connection;
+
+/**
+ * Defines an UcWishlistManager service.
+ */
+class UcWishlistManager {
+
+  /**
+   * The database connection.
+   *
+   * @var \Drupal\Core\Database\Connection
+   */
+  protected $connection;
+
+  /**
+   * Constructs an UcWishlistManager object.
+   *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The connection object.
+   */
+  public function __construct(Connection $connection) {
+    $this->connection = $connection;
+  }
+
+  /**
+   * This function retrieves a list of wish lists created by
+   * a specific user based on the wid, uid, wish list title
+   * and expiration status.
+   *
+   * @return \Drupal\Core\Database\StatementInterface[]
+   *   List of wish lists created by any particular user.
+   */
+  public function getAllWishlist() {
+    $query = $this->connection->select('uc_wishlists', 'w');
+    $query->leftJoin('users', 'u', 'w.uid = u.uid');
+    $query->fields('w', [
+      'wid',
+      'uid',
+      'title',
+      'expiration',
+    ]);
+    $result = $query->execute();
+    /**
+     * @todo
+     * extend default pager limit
+     * $query->extend('PagerDefault')->limit(25)->execute();
+     */
+    return $result;
+  }
+
+  /**
+   * This function is invoked to create a particular user wish
+   * list referring to the custom fields involved.
+   *
+   * @param $fields
+   *   variable that contains all the custom fields for creating a
+   *   wish list.
+   *
+   * @param $values
+   *   refers to the values of the wish list product parameters for
+   *   creating a specific user wish list.
+   *
+   * @return array
+   *   creates a user wish list.
+   */
+  public function createWishlist($fields, $values) {
+    $this->connection->insert('uc_wishlists')->fields($fields, $values)->execute();
+  }
+
+  /**
+   * This function is invoked to create/add related wish list
+   * products with reference to the set of custom fields involved.
+   *
+   * @param $fields
+   *   variable that contains all the custom fields for creating a
+   *   wish list.
+   *
+   * @param $values
+   *   refers to the values of the wish list product parameters for
+   *   creating a specific user wish list.
+   *
+   * @return array
+   *   displays a list of wish list products.
+   */
+  public function createWishlistProduct($fields, $values) {
+    $this->connection->insert('uc_wishlist_products')->fields($fields, $values)->execute();
+  }
+
+  /**
+   * This function retrieves the id of a particular wish list
+   * by referring to the corresponding user id.
+   *
+   * @param $uid
+   *   refers to the id used for retrieving specific wish
+   *    lists created by a specific user.
+   *
+   * @return int
+   *   The id of the desired wish list.
+   */
+  public function getWishlistIdByUser($uid) {
+    $this->connection->query('SELECT wid FROM {uc_wishlists} WHERE uid = :uid;', [':uid' => $uid])->fetchField();
+  }
+
+  /**
+   * This function retrieves a specific wish list product with
+   * reference to the parameters wid, nid and data provided as
+   * input.
+   *
+   * @param $wid
+   *   refers to a particular wish list id used to retrieve a
+   *   specific wish list item.
+   *
+   * @param $nid
+   *   refers to a particular node id used to retrieve a specific
+   *   wish list item.
+   *
+   * @param $data
+   *   refers to the data associated with a particular wish list
+   *   item.
+   *
+   * @return string
+   *   A specific wishlist product by referring to the
+   *   corresponding wid, nid and associated data.
+   */
+  public function getWishlistItem($wid, $nid, $data) {
+    $this->connection->query("SELECT * FROM {uc_wishlist_products} WHERE wid = :wid AND nid = :nid AND data = :data", [':wid' => $wid, ':nid' => $nid, ':data' => serialize($data)]);
+  }
+
+  /**
+   * This function displays the list of wish lists created by
+   * a user by providing specific matching keywords referring to
+   * a user name, wish list title and address.
+   *
+   * @param $keywords
+   *   refers to the keywords to make three queries and return
+   *   a new DatabaseCondition.
+   *
+   * @return string
+   *   displays a list of user wish lists.
+   */
+  public function searchUserWishlist($keywords) {
+    if (!empty($keywords)) {
+      // Check for user, wish list title, or address matches.
+      $query = $this->connection->select('uc_wishlists', 'w');
+      $query->join('users', 'u', 'w.uid = u.uid');
+      $query->fields('w', [
+        'wid',
+        'title',
+      ]);
+      $query->distinct();
+      $query->condition(db_or()
+        ->condition('u.name', '%' . $keywords . '%', 'LIKE')
+        ->condition('w.title', '%' . $keywords . '%', 'LIKE')
+        ->condition('w.address', '%' . $keywords . '%', 'LIKE'));
+    }
+    else {
+      $query = $this->connection->select('uc_wishlists', 'w');
+      $query->fields('w', [
+        'wid',
+        'title',
+      ]);
+    }
+    $query->condition('w.private', 0, '=');
+    $result = $query->orderBy('w.title')->execute;
+    /**
+     * @todo
+     * extend default pager limit
+     * $query->extend('PagerDefault')->limit(25)->execute();
+     */
+    return $result;
+  }
+
+  /**
+   * This function retrieves a specific wish list by passing
+   * a particular wid as the function parameter.
+   *
+   * @param int $wid
+   *   Displays a particular wish list by retrieving
+   *   its wid.
+   *
+   * @return array
+   *   displays a specific wish list to the user.
+   */
+  public function getWishlist($wid) {
+    $this->connection->query("SELECT * FROM {uc_wishlists} WHERE wid = :wid", [':wid' => $wid]);
+  }
+
+  /**
+   * @param $rid
+   *   refers to the user role id for a specific user
+   *   account.
+   *
+   * @param $created
+   *   refers to the created user for a particular user
+   *   account.
+   */
+  public function selectAccounts($rid, $created) {
+    $query = $this->connection->select('users', 'u');
+    $query->innerJoin('user_roles', 'ur', 'u.uid = ur.uid');
+    $query->where('ur.rid = :rid AND u.created < :created', [
+      ':rid' => $rid,
+      ':created' => $created,
+    ]);
+    return $query->execute();
+  }
+
+  /**
+   * Any specific wish list product can be selected by invoking
+   * this function for altering/removing it.
+   *
+   * @param $wid
+   *   refers to a particular wish list id.
+   *
+   * @return string
+   *   select(s) a any specific wishlist product.
+   */
+  public function selectWishlistProducts($wid) {
+    $query = $this->connection->select('node', 'n');
+    $query->join('uc_wishlist_products', 'w', 'n.nid = w.nid');
+    $query->fields('w');
+    $query->addField('n', 'vid');
+    $query->condition('w.wid', $wid);
+    $query->addTag('node_access');
+    $query->join('node_field_data', 'f', 'n.nid = f.nid');
+    $query->addField('f', 'title');
+
+    $result = $query->execute();
+    return $result;
+  }
+
+  /**
+   * The wish list gets updated on altering the allotted quantity
+   * of any product within the list by invoking this function and
+   * passing the wpid and qty variables as parameters.
+   *
+   * @param $wpid
+   *   refers to a particular wish list product id.
+   *
+   * @param $qty
+   *   refers to the quantity assigned to the corresponding
+   *   wish list product.
+   *
+   * @return int
+   *   An updated wish list product quantity.
+   */
+  public function updateWantedQuantity($wpid, $qty) {
+    $this->connection->update('uc_wishlist_products')->fields(['qty' => $qty])->condition('wpid', $wpid, '=')->execute();
+  }
+
+  /**
+   * This function is invoked to delete a specific user
+   * wish list by passing the wid as a parameter.
+   *
+   * @param $wid
+   *   points to a particular wish list id.
+   *
+   * @return string
+   *   Deletes a particular wish list.
+   */
+  public function deleteWishlist($wid) {
+    $this->connection->delete('uc_wishlists')->condition('wid', $wid)->execute();
+    $this->connection->delete('uc_wishlist_products')->condition('wid', $wid)->execute();
+  }
+
+  /**
+   * Checks the availability of a particular product within a wish
+   * list. Returns true, otherwise returns false if product is not
+   * found.
+   *
+   * @param $wid
+   *   refers to a particular wish list id.
+   *
+   * @param $pid
+   *   refers to a particular product id.
+   *
+   * @return bool
+   *   Returns true if product within list, otherwise false.
+   */
+  public function isProductInWishlist($wid, $pid) {
+    $this->connection->query("SELECT * FROM {uc_wishlist_products} WHERE nid = :pid AND wid = :wid", [':pid' => $pid, ':wid' => $wid]);
+    return $this->connection;
+  }
+
+  /**
+   * Any specific wish list product can be removed from the list by
+   * passing the wpid as a parameter.
+   *
+   * @param $pid
+   *   refers to the id of a particular wish list product.
+   *
+   * @return string
+   *   Removes the selected item from the wishlist.
+   */
+  public function removeItem($wpid) {
+    $this->connection->delete('uc_wishlist_products')->condition('wpid', $wpid)->execute();
+    return $this->connection;
+  }
+
+  /**
+   * This function is invoked to remove a specific product
+   * using the pid.
+   *
+   * @param $pid
+   *   refers to the id of a particular product.
+   *
+   * @return string
+   *   Removes the desired product using the pid.
+   */
+  public function removeProduct($pid) {
+    $this->connection->delete('uc_wishlist_products')->condition('nid', $pid)->execute();
+    return $this->connection;
+  }
+
+}
diff --git a/src/Entity/UcWishlist.php b/src/Entity/UcWishlist.php
index bd339ee..1016145 100644
--- a/src/Entity/UcWishlist.php
+++ b/src/Entity/UcWishlist.php
@@ -94,20 +94,20 @@ class UcWishlist extends ContentEntityBase implements UcWishlistInterface {
       ->setSetting('target_type', 'user')
       ->setDefaultValueCallback('Drupal\uc_wishlist\Entity\UcWishlist::getCurrentUserId')
       ->setTranslatable(TRUE)
-      ->setDisplayOptions('view', array(
+      ->setDisplayOptions('view', [
         'label' => 'hidden',
         'type' => 'author',
         'weight' => 0,
-      ))
-      ->setDisplayOptions('form', array(
+      ])
+      ->setDisplayOptions('form', [
         'type' => 'entity_reference_autocomplete',
         'weight' => 5,
-        'settings' => array(
+        'settings' => [
           'match_operator' => 'CONTAINS',
           'size' => '60',
           'placeholder' => '',
-        ),
-      ))
+        ],
+      ])
       ->setDisplayConfigurable('form', TRUE);
 
     $fields['expiration'] = BaseFieldDefinition::create('timestamp')
@@ -221,6 +221,7 @@ class UcWishlist extends ContentEntityBase implements UcWishlistInterface {
    *   An array of default values.
    */
   public static function getCurrentUserId() {
-    return array(\Drupal::currentUser()->id());
+    return [\Drupal::currentUser()->id()];
   }
+
 }
diff --git a/src/Entity/UcWishlistInterface.php b/src/Entity/UcWishlistInterface.php
index 8d9a4db..bf1dace 100644
--- a/src/Entity/UcWishlistInterface.php
+++ b/src/Entity/UcWishlistInterface.php
@@ -8,7 +8,6 @@ namespace Drupal\uc_wishlist\Entity;
 
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\user\EntityOwnerInterface;
-use Drupal\Core\Entity\EntityChangedInterface;
 
 /**
  * Provides an interface defining a wish list entity type.
@@ -26,10 +25,10 @@ interface UcWishlistInterface extends ContentEntityInterface, EntityOwnerInterfa
   /**
    * Sets wishlist title.
    *
-   * @param string $title.
+   * @param string $title
    *   Wishlist title.
    *
-   * @return $this;
+   * @return this
    */
   public function setTitle($title);
 
@@ -47,7 +46,7 @@ interface UcWishlistInterface extends ContentEntityInterface, EntityOwnerInterfa
    * @param int $expiration
    *   Wishlist expiration timestamp.
    *
-   * @return $this;
+   * @return this
    */
   public function setExpirationTime($expiration);
 
@@ -65,7 +64,7 @@ interface UcWishlistInterface extends ContentEntityInterface, EntityOwnerInterfa
    * @param string $address
    *   Wishlist address.
    *
-   * @return $this;
+   * @return this
    */
   public function setAddress($address);
 
@@ -83,7 +82,7 @@ interface UcWishlistInterface extends ContentEntityInterface, EntityOwnerInterfa
    * @param string $description
    *   Wishlist private status.
    *
-   * @return $this;
+   * @return this
    */
   public function setPrivate($description);
 
@@ -101,11 +100,12 @@ interface UcWishlistInterface extends ContentEntityInterface, EntityOwnerInterfa
    * @param string $description
    *   Wishlist description.
    *
-   * @return $this;
+   * @return this
    */
   public function setdescription($description);
+
   /**
-   * Renders the user id of the owner
+   * Renders the user id of the owner.
    *
    * @return int
    *   id of user.
diff --git a/src/Form/UCWishlistAdminDeleteForm.php b/src/Form/UCWishlistAdminDeleteForm.php
index dd39641..e50562b 100644
--- a/src/Form/UCWishlistAdminDeleteForm.php
+++ b/src/Form/UCWishlistAdminDeleteForm.php
@@ -1,17 +1,47 @@
 <?php
-/**
- * Confirm the deletion of a wish list.
- */
+
 namespace Drupal\uc_wishlist\Form;
 
-use Drupal\uc_wishlist\Database\DBQuery;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\uc_wishlist\Database\UcWishlistManager;
 use Drupal\Core\Url;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
+/**
+ *
+ */
 class UCWishlistAdminDeleteForm extends ConfirmFormBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  protected $wishlistManager;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct(UcWishlistManager $wishlist_manager) {
+    $this->wishlistManager = $wishlist_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('uc_wishlist.manager')
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   protected $user;
+
+  /**
+   * {@inheritdoc}
+   */
   protected $wishlistId;
 
   /**
@@ -53,9 +83,6 @@ class UCWishlistAdminDeleteForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, $wishlist = NULL) {
-    $this->node = $node;
-    $this->featureId = $fid;
-    $this->feature = uc_product_feature_load($pfid);
     $wishlist = uc_wishlist_load($wishlist);
     $form['wishlist'] = [
       '#type' => 'value',
@@ -69,9 +96,7 @@ class UCWishlistAdminDeleteForm extends ConfirmFormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $values = $form_state->getValues();
-    $database = new DBQuery(\Drupal::database());
-    $database->deleteWishlist($values['wishlist']->wid);
-    drupal_set_message(t('@title has been deleted.', ['@title' => str_replace('.','',$values['wishlist']->title)]));
+    drupal_set_message($this->t('@title has been deleted.', ['@title' => str_replace('.', '', $values['wishlist']->title)]));
     $form_state->setRedirect('uc_wishlist.admin_wishlist');
   }
 
diff --git a/src/Form/UserWishlistSettingsForm.php b/src/Form/UserWishlistSettingsForm.php
new file mode 100644
index 0000000..f6b56e0
--- /dev/null
+++ b/src/Form/UserWishlistSettingsForm.php
@@ -0,0 +1,216 @@
+<?php
+
+namespace Drupal\uc_wishlist\Form;
+
+use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Session\AccountInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Constructs the UserWishlistSettingsForm class.
+ *
+ * Contains user wishlist settings to extend the
+ * user with the option to modify/update a wish list.
+ */
+class UserWishlistSettingsForm extends ConfigFormBase {
+
+  /**
+   * @var \Drupal\Core\Session\AccountInterface
+   */
+  protected $account;
+
+  /**
+   * @param \Drupal\Core\Session\AccountInterface $account
+   */
+  public function __construct(AccountInterface $account) {
+    $this->account = $account;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('current_user')
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'wishlist_user_settings';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEditableConfigNames() {
+    return ['uc_wishlist.settings'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $config = $this->config('uc_wishlist.settings');
+    $wid = $form_state->getValues('id');
+    $wishlist = uc_wishlist_load($wid);
+
+    $form = [];
+
+    $form['wishlist'] = [
+      '#type' => 'fieldset',
+    ];
+    $form['wishlist']['wid'] = [
+      '#type' => 'hidden',
+      '#value' => $wishlist->wid,
+    ];
+    $form['wishlist']['title'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Title'),
+      '#default_value' => $wishlist->title,
+      '#required' => TRUE,
+    ];
+    $form['wishlist']['expiration'] = [
+      '#type' => 'date',
+      '#title' => $this->t('Event or expiration date'),
+      '#default_value' => $expiration,
+      '#description' => $this->t('If this wish list is associated with an event or will no longer be relevant on a specific date, enter it here.'),
+    ];
+
+    if (!$config->get('default_private', TRUE) && $config->get('allow_private', TRUE)) {
+      $form['wishlist']['private'] = [
+        '#type' => 'checkbox',
+        '#title' => $this->t('Private'),
+        '#default_value' => $wishlist->private,
+        '#description' => $this->t('Check this to make your wish list private and exclude it from wish list search results.'),
+      ];
+    }
+
+    if ($config->get('save_address', TRUE)) {
+      $form['wishlist']['address'] = [
+        '#type' => 'fieldset',
+        '#title' => $this->t('Mailing address'),
+        '#description' => $this->t('The address you enter here will be available as a shipping address to anyone who purchases an item from your wish list.'),
+      ];
+
+      /**
+       *if (($account->id()) {
+       * $addresses = uc_select_address(($account->id()), 'delivery', 'apply_address(\'delivery\', this.value);', t('Saved addresses'), TRUE);
+       * if (!empty($addresses)) {
+       * $form['wishlist']['address']['delivery_address_select'] = $addresses;
+       * unset($form['wishlist']['address']['delivery_address_select']['#suffix']);
+       * }
+       * }
+       */
+
+      if (uc_address_field_enabled('first_name')) {
+        $form['wishlist']['address']['delivery_first_name'] = uc_textfield(uc_get_field_name('first_name'), empty($wishlist->address->firstname) ? NULL : $wishlist->address->firstname, uc_address_field_required('first_name'));
+      }
+      if (uc_address_field_enabled('last_name')) {
+        $form['wishlist']['address']['delivery_last_name'] = uc_textfield(uc_get_field_name('last_name'), empty($wishlist->address->lastname) ? NULL : $wishlist->address->lastname, uc_address_field_required('last_name'));
+      }
+      if (uc_address_field_enabled('company')) {
+        $form['wishlist']['address']['delivery_company'] = uc_textfield(uc_get_field_name('company'), empty($wishlist->address->company) ? NULL : $wishlist->address->company, uc_address_field_required('company'), NULL, 64);
+      }
+      if (uc_address_field_enabled('street1')) {
+        $form['wishlist']['address']['delivery_street1'] = uc_textfield(uc_get_field_name('street1'), empty($wishlist->address->addr1) ? NULL : $wishlist->address->addr1, uc_address_field_required('street1'), NULL, 64);
+      }
+      if (uc_address_field_enabled('street2')) {
+        $form['wishlist']['address']['delivery_street2'] = uc_textfield(uc_get_field_name('street2'), empty($wishlist->address->addr2) ? NULL : $wishlist->address->addr2, uc_address_field_required('street2'), NULL, 64);
+      }
+      if (uc_address_field_enabled('city')) {
+        $form['wishlist']['address']['delivery_city'] = uc_textfield(uc_get_field_name('city'), empty($wishlist->address->city) ? NULL : $wishlist->address->city, uc_address_field_required('city'));
+      }
+      if (uc_address_field_enabled('country')) {
+        $form['wishlist']['address']['delivery_country'] = [
+          '#type' => 'select',
+          '#title' => uc_get_field_name('country'),
+          '#description' => NULL,
+          '#required' => uc_address_field_required('country'),
+          '#options' => uc_country_option_list(),
+          '#default_value' => isset($wishlist->address->country) ? $wishlist->address->country : uc_store_default_country(),
+        ];
+      }
+      if (uc_address_field_enabled('zone')) {
+        if (isset($_POST['delivery_country'])) {
+          $country_id = intval(check_plain($_POST['delivery_country']));
+        }
+        else {
+          $country_id = isset($wishlist->address->country) ? $wishlist->address->country : uc_store_default_country();
+        }
+        $form['wishlist']['address']['delivery_zone'] = uc_zone_select(uc_get_field_name('zone'), empty($wishlist->address->zone) ? NULL : $wishlist->address->zone, $country_id, ['required' => uc_address_field_required('zone')]);
+        if (isset($_POST['panes']) && count($form['wishlist']['address']['delivery_zone']['#options']) == 1) {
+          $form['wishlist']['address']['delivery_zone']['#required'] = FALSE;
+        }
+      }
+      if (uc_address_field_enabled('postal_code')) {
+        $form['wishlist']['address']['delivery_postal_code'] = uc_textfield(uc_get_field_name('postal_code'), empty($wishlist->address->postcode) ? NULL : $wishlist->address->postcode, uc_address_field_required('postal_code'), NULL, 10, 10);
+      }
+      if (uc_address_field_enabled('phone')) {
+        $form['wishlist']['address']['delivery_phone'] = uc_textfield(uc_get_field_name('phone'), empty($wishlist->address->phone) ? NULL : $wishlist->address->phone, uc_address_field_required('phone'), NULL, 32, 16);
+      }
+    }
+
+    $form['wishlist']['save'] = [
+      '#type' => 'submit',
+      '#value' => $this->t('Save settings'),
+    ];
+
+    return $form;
+
+  }
+
+  /**
+   * Validation handler for wish list settings form.
+   */
+  public function validateForm(array &$form, FormStateInterface $form_state) {
+
+    $wid = $form_state->getValues('id');
+
+    $wishlist = uc_wishlist_load($wid);
+    if (!$wishlist) {
+      drupal_set_message($this->t('Could not find the specified wish list.'), 'error');
+      return FALSE;
+    }
+    if ($wishlist->id() != $this->account->id() && !$this->account->hasPermission('administer store')) {
+      drupal_set_message($this->t('You do not have permission to edit this wish list.'), 'error');
+      return FALSE;
+    }
+  }
+
+  /**
+   * Submission handler for wish list settings form.
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $expiration = mktime(0, 0, 0, $form_state->getValue(['expiration', 'month']), $form_state->getValue(['expiration', 'day']), $form_state > getValue(['expiration', 'year']));
+    $values = $form_state->getValues();
+    $config = $this->config('uc_wishlist.settings');
+
+    if ($config->get('save_address', TRUE)) {
+      $address = [
+        'firstname' => $form_state->getValues['delivery_first_name'],
+        'lastname' => $form_state->getValues['delivery_last_name'],
+        'company' => $form_state->isValueEmpty['delivery_company'] ? '' : $form_state->getValues['delivery_company'],
+        'addr1' => $form_state->getValues['delivery_street1'],
+        'addr2' => $form_state->isValueEmpty['delivery_street2'] ? '' : $form_state->getValues['delivery_street2'],
+        'city' => $form_state->getValues['delivery_city'],
+        'country' => $form_state->getValues['delivery_country'],
+        'zone' => $form_state->getValues['delivery_zone'],
+        'postcode' => $form_state->getValues['delivery_postal_code'],
+        'phone' => $form_state->isValueEmpty['delivery_phone'] ? '' : $form_state->getValues['delivery_phone'],
+      ];
+    }
+
+    else {
+      $address = NULL;
+    }
+
+    $private = $config->get('default_private', FALSE) ? $config->get('default_private', FALSE) : 0;
+    $private = $config->get('allow_private', FALSE) ? $form_state->getValues['private'] : $private;
+    drupal_set_message($this->t('Your wish list has been updated.'));
+  }
+
+}
diff --git a/src/Form/WishlistEmailForm.php b/src/Form/WishlistEmailForm.php
index d94558c..ebb5322 100644
--- a/src/Form/WishlistEmailForm.php
+++ b/src/Form/WishlistEmailForm.php
@@ -5,6 +5,9 @@ namespace Drupal\uc_wishlist\Form;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 
+/**
+ *
+ */
 class WishlistEmailForm extends FormBase {
 
   /**
@@ -48,6 +51,9 @@ class WishlistEmailForm extends FormBase {
     return $form;
   }
 
+  /**
+   *
+   */
   public function validateForm(array &$form, FormStateInterface $form_state) {
 
     // Exploding the emails id of the recpients.
@@ -79,9 +85,10 @@ class WishlistEmailForm extends FormBase {
     $wid = $form_state->getValue['id'];
     $message = $message . "\n" . l(t('Wishlist'), 'wishlist/' . $wid);
     foreach ($emails as $email) {
-      uc_wishlist_send_mail($email, $subject, $message);
+    uc_wishlist_send_mail($email, $subject, $message);
     }*/
     drupal_set_message($this->t('Your wishlist has been emailed!', ['recipients' => $form_state->getValue('recipients')]));
-      $form_state->setRedirect('uc_wishlist.wishlist.email_form');
+    $form_state->setRedirect('uc_wishlist.wishlist.email_form');
   }
-}
\ No newline at end of file
+
+}
diff --git a/src/Form/WishlistSearchForm.php b/src/Form/WishlistSearchForm.php
index 1735e39..1dbb7c4 100644
--- a/src/Form/WishlistSearchForm.php
+++ b/src/Form/WishlistSearchForm.php
@@ -2,23 +2,38 @@
 
 namespace Drupal\uc_wishlist\Form;
 
-use Drupal\uc_wishlist\Database\DBQuery;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Component\Utility\Xss;
-use Drupal\User\Entity;
+use Drupal\Core\Session\AccountInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
+/**
+ *
+ */
 class WishlistSearchForm extends FormBase {
 
-  //protected $database;
+  /**
+   * @var \Drupal\Core\Session\AccountInterface
+   */
+  protected $account;
 
   /**
-   *public function __construct() {
-      $this->db = new Database\DBQuery(\Drupal::database());
-    }
-   *
+   * @param \Drupal\Core\Session\AccountInterface $account
    */
+  public function __construct(AccountInterface $account) {
+    $this->account = $account;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('current_user')
+    );
+  }
 
   /**
    * {@inheritdoc}
@@ -32,21 +47,8 @@ class WishlistSearchForm extends FormBase {
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
 
-    $account = \Drupal::currentUser();
-    //$user = User::load($account->id());
     $form = [];
 
-    /**
-     * if (!$account->id() && !$account->hasPermission('create wish lists')) {
-         $path = 'user';
-         $query = ['destination' => 'wishlist'];
-        }
-    $form['wishlist_link'] = [
-      '#type' => 'item',
-      '#markup' => '<div>' . l(t('Create or manage your wish list.'), $path, array('query' => $query)) . '</div>',
-    ];
-    */
-
     $form['search'] = [
       '#type' => 'fieldset',
     ];
@@ -63,15 +65,6 @@ class WishlistSearchForm extends FormBase {
 
     $links = [];
 
-    //$result = $this->db->searchUserWishlist($keywords);
-
-    foreach ($result as $wishlist) {
-      $links[] = [
-        'title' => Xss::filter($wishlist->title, []),
-        'href' => 'wishlist/' . $wishlist->wid,
-      ];
-    }
-
     if (!empty($links)) {
       $output = [
         'links' => $links,
@@ -85,7 +78,6 @@ class WishlistSearchForm extends FormBase {
       $output = ' ' . t('No wish lists found.');
     }
 
-
     $form['output'] = [
       '#type' => 'item',
       '#markup' => Xss::filter('<div><h2>' . t('Wish lists:') . '</h2>' . $output . '</div>'),
@@ -107,4 +99,5 @@ class WishlistSearchForm extends FormBase {
     }
 
   }
+
 }
diff --git a/src/Form/WishlistViewForm.php b/src/Form/WishlistViewForm.php
index b6fb0aa..a5eeb3c 100644
--- a/src/Form/WishlistViewForm.php
+++ b/src/Form/WishlistViewForm.php
@@ -7,31 +7,52 @@ use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Link;
 use Drupal\Core\Url;
+use Drupal\node\Entity\Node;
+use Drupal\uc_wishlist\Database\UcWishlistManager;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
+/**
+ *
+ */
 class WishlistViewForm extends FormBase {
 
-  protected $database;
+  /**
+   * {@inheritdoc}
+   */
+  protected $ucwishlistManager;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct(UcWishlistManager $ucwishlist_manager) {
+    $this->ucwishlistManager = $ucwishlist_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('uc_wishlist.manager')
+    );
+  }
 
-  //public function __construct()
-//  {
-  //  $this->database = new \Drupal::database();
-  //}
   /**
    * {@inheritdoc}
    */
-  public function getFormId(){
+  public function getFormId() {
     return 'uc_wishlistViewForm';
   }
+
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, $items = null, $wid = null, $own = null){
+  public function buildForm(array $form, FormStateInterface $form_state, $items = NULL, $wid = NULL, $own = NULL) {
     $form['items'] = [
       '#tree' => TRUE,
 
     ];
 
-    $form['#attached']['library'][] = 'uc_wishlist/ideal_image_slider';
     $form['#attached']['library'][] = 'uc_wishlist/default';
     $sliderNumber = 1;
     // Load each wish list product and add it to the form array.
@@ -40,7 +61,7 @@ class WishlistViewForm extends FormBase {
       $node = Node::load($item->nid);
       $element = [
         '#prefix' => '<div class="uc_wishlist_product_item">',
-        '#suffix' => '</div>'
+        '#suffix' => '</div>',
       ];
 
       $element['nid'] = [
@@ -59,7 +80,7 @@ class WishlistViewForm extends FormBase {
       if ($own) {
         $element['remove'] = [
           '#type' => 'checkbox',
-          '#title' => 'Remove'
+          '#title' => 'Remove',
         ];
       }
 
@@ -70,33 +91,31 @@ class WishlistViewForm extends FormBase {
 
       $element['title'] = [
         '#type' => 'item',
-        '#markup' => Link::fromTextAndUrl($item->title, Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]))->toString(),
+        '#markup' => Link::fromTextAndUrl($item->title, Url::fromRoute('entity.node.canonical', ['node' => $node->id()]))->toString(),
       ];
-      $imagesFound = false;
+      $imagesFound = FALSE;
       $imageUrls = [];
       $numberOfImages = 0;
-      while(!$imagesFound)
-      {
-        if($node->get('uc_product_image')[$numberOfImages] != null) {
+      while (!$imagesFound) {
+        if ($node->get('uc_product_image')[$numberOfImages] != NULL) {
           $imageUrls[] = $node->get('uc_product_image')[$numberOfImages]->entity->url();
           $numberOfImages = $numberOfImages + 1;
         }
         else {
-          $imagesFound = true;
+          $imagesFound = TRUE;
           break;
         }
       }
       $element['images'] = [
-        '#tree'=>true,
-        '#prefix' => '<div id="wishlist_image_container"> <div class="wishlist_slider" id="wishlist_slider_'.$sliderNumber.'" style="width:150px;height:150px;" class="uc_wishlist_product_images">',
-        '#suffix' => '</div></div>'
+        '#tree' => TRUE,
+        '#prefix' => '<div id="wishlist_image_container"> <div class="wishlist_slider" id="wishlist_slider_' . $sliderNumber . '" style="width:150px;height:150px;" class="uc_wishlist_product_images">',
+        '#suffix' => '</div></div>',
       ];
       $sliderNumber++;
-      foreach($imageUrls as $key=>$value)
-      {
-        $element['images']['image_'.$key] = [
+      foreach ($imageUrls as $key => $value) {
+        $element['images']['image_' . $key] = [
           '#type' => 'item',
-          '#markup' => '<img alt="test" class="uc_wishlistProductImage" src="'.$value.'" width="150" height="150" />',
+          '#markup' => '<img alt="test" class="uc_wishlistProductImage" src="' . $value . '" width="150" height="150" />',
           '#theme_wrappers' => [],
 
         ];
@@ -105,12 +124,10 @@ class WishlistViewForm extends FormBase {
       $description = $node->get('body')->getValue();
 
       // Now allow alterations via hook_uc_product_description_alter().
-
       if ($description) {
         $element['description'] = [
           '#type' => 'item',
-          //'#title' => 'Product Description',
-          '#markup' => mb_strimwidth($description[0]['value'],0,50,'...'.Link::fromTextAndUrl('More', Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]))->toString()),
+          '#markup' => mb_strimwidth($description[0]['value'], 0, 50, '...' . Link::fromTextAndUrl('More', Url::fromRoute('entity.node.canonical', ['node' => $node->id()]))->toString()),
         ];
       }
 
@@ -119,51 +136,45 @@ class WishlistViewForm extends FormBase {
         '#value' => $form_state->get('variant') ?: $node,
       ];
 
-      //$element['#total'] = $item->price; //* $item->qty;
-
       $element['data'] = [
         '#type' => 'hidden',
         '#value' => serialize($item->data),
       ];
-      if($own) {
+      if ($own) {
         $element['wanted_qty'] = [
           '#type' => 'uc_quantity',
           '#title' => 'Wanted Quantity',
-          '#default_value' => $item->qty
+          '#default_value' => $item->qty,
         ];
       }
       else {
         $element['wanted_qty'] = [
           '#type' => 'item',
           '#title' => 'Wanted Quantity',
-          '#markup' => '<p class="wanted_quantity">'.$item->qty.'</p>'
+          '#markup' => '<p class="wanted_quantity">' . $item->qty . '</p>',
         ];
       }
       $price = $node->get('price')->getValue()[0]['value'];
       $element['total_price'] = [
-        '#type'=>'item',
-        '#title'=>'Price for wanted quantity',
-        '#markup'=>'<p class="total_price"$>'.floatval ($price)*$item->qty.'</p>',
+        '#type' => 'item',
+        '#title' => 'Price for wanted quantity',
+        '#markup' => '<p class="total_price"$>' . floatval($price) * $item->qty . '</p>',
       ];
       $element['qty'] = [
         '#type' => 'uc_quantity',
         '#title' => 'Your Quantity',
-        '#default_value' => '1'
+        '#default_value' => '1',
       ];
       $element['price'] = [
-        '#type'=>'item',
-        '#title'=>'Your Price',
-        '#markup'=>'<p class="price">$'.floatval ($price).'</p>',
+        '#type' => 'item',
+        '#title' => 'Your Price',
+        '#markup' => '<p class="price">$' . floatval($price) . '</p>',
       ];
 
-
-
       // Checking if uc_stock module is install in the site and
       // prevent user to add product into cart if the stock value of the product
       // is equal to 0.
-
       // Checking if uc_stock module install in the site.
-
       if (\Drupal::moduleHandler()->moduleExists('uc_stock')) {
 
         // If product kit module is installed in the site and wishlist node type
@@ -173,7 +184,6 @@ class WishlistViewForm extends FormBase {
           // Getting the number of products attached with the Product Kit.
           // As there is no stock configuration, so we will check the stock value
           // of the each product of Product Kit.
-
           // If all products of the Product Kit has stock active, then we allow
           // user to purchase product kit.
           // @var unknown_type .
@@ -204,7 +214,7 @@ class WishlistViewForm extends FormBase {
             '#type' => 'submit',
             '#name' => 'addcart-' . $itemNum,
             '#value' => 'Add to cart',
-            '#submit' => ['addToCart']
+            '#submit' => ['addToCart'],
           ];
 
         }
@@ -221,7 +231,7 @@ class WishlistViewForm extends FormBase {
           '#type' => 'submit',
           '#name' => 'addcart-' . $itemNum,
           '#value' => 'Add to cart',
-          '#submit' => ['addToCart']
+          '#submit' => ['addToCart'],
         ];
       }
       $itemNum++;
@@ -241,7 +251,7 @@ class WishlistViewForm extends FormBase {
       ];
       $form['update'] = [
         '#type' => 'submit',
-        '#attributes' => array('class'=> array('uc_wishlist_update_wishlist')),
+        '#attributes' => ['class' => ['uc_wishlist_update_wishlist']],
         '#name' => 'uc_wishlist_update_wishlist',
         '#value' => 'Update wish list',
       ];
@@ -260,36 +270,31 @@ class WishlistViewForm extends FormBase {
   /**
    * {@inheritdoc}
    */
-  public function submitForm(array &$form, FormStateInterface $form_state){
+  public function submitForm(array &$form, FormStateInterface $form_state) {
 
     $values = $form_state->getValues();
-    //get the products post data and iterate them to update one by one
+    // Get the products post data and iterate them to update one by one.
     $items = $values['items'];
-    foreach($items as $item)
-    {
+    foreach ($items as $item) {
       $wpid = $item['wpid'];
       $remove = $item['remove'];
       $node = Node::load($item['nid']);
       $title = $node->get('title')->getValue()[0]['value'];
       $title = Xss::filter($title);
 
-      //check to see if the user wanted to remove this product from the wish list and if so then delete it
-      if($remove)
-      {
-        $this->database->remove_item($wpid);
-        drupal_set_message($this->t('<b>@product_title</b> has been removed from <a href="@url">your wish list</a>.',['@product_title'=>$title,'@url'=>Url::fromRoute('uc_wishlist.wishlist')]));
+      // Check to see if the user wanted to remove this product from the wish list and if so then delete it.
+      if ($remove) {
+        drupal_set_message($this->t('<b>@product_title</b> has been removed from <a href="@url">your wish list</a>.', ['@product_title' => $title, '@url' => Url::fromRoute('uc_wishlist.wishlist')]));
       }
       else {
-        //update the information for this product in the wish list
-        //user wanted quantity of the product
+        // Update the information for this product in the wish list
+        // user wanted quantity of the product.
         $wanted_qty = $item['wanted_qty'];
-        //dpm($wpid);
-        //drupal_set_message($this->t('<b>@product_title</b> \'Wanted Quantity\' has been updated. <a href="@url">your wish list</a>.',['@product_title'=>$title,'@url'=>Url::fromRoute('uc_wishlist.wishlist')]));
-        $database = new \Drupal\uc_wishlist\Database\DBQuery(\Drupal::database());
-        $database->updateWantedQuantity($wpid,$wanted_qty);
+        $this->ucwishlistManager->updateWantedQuantity($wpid, $wanted_qty);
       }
     }
     drupal_set_message($this->t('Your wish list has been updated'));
     $form_state->setRedirectUrl(Url::fromRoute('uc_wishlist.wishlist'));
   }
+
 }
diff --git a/src/UcWishlistListBuilder.php b/src/UcWishlistListBuilder.php
index eae4dde..3c9b15b 100644
--- a/src/UcWishlistListBuilder.php
+++ b/src/UcWishlistListBuilder.php
@@ -4,7 +4,6 @@ namespace Drupal\uc_wishlist;
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityListBuilder;
-use Drupal\Core\Url;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
@@ -14,7 +13,7 @@ use Drupal\Core\Routing\RedirectDestinationInterface;
 /**
  * Defining a class for building list of wishlist entities.
  *
- *@see \Drupal\uc_wishlist\Entity\UcWishlist
+ * @see \Drupal\uc_wishlist\Entity\UcWishlist
  */
 class UcWishlistListBuilder extends EntityListBuilder {
 
diff --git a/uc_wishlist.info.yml b/uc_wishlist.info.yml
index bdf2d99..eec600e 100644
--- a/uc_wishlist.info.yml
+++ b/uc_wishlist.info.yml
@@ -3,7 +3,7 @@ type: module
 description: 'Allows users to create public shopping wish lists.'
 core: 8.x
 package: 'Ubercart - extra'
-configure: admin/store/settings/wishlist
+configure: uc_wishlist.settings
 
 dependencies:
   - uc_cart
diff --git a/uc_wishlist.install b/uc_wishlist.install
index f18fb9d..84c1a3a 100644
--- a/uc_wishlist.install
+++ b/uc_wishlist.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * uc_wishlist installation routine. Creates uc_wishlists and
+ * Uc_wishlist installation routine. Creates uc_wishlists and
  * uc_wishlist_products tables.
  */
 
@@ -53,7 +53,7 @@ function uc_wishlist_schema() {
       ],
     ],
     'indexes' => [
-       'uid' => ['uid'],
+      'uid' => ['uid'],
     ],
     'primary key' => ['wid'],
   ];
@@ -112,15 +112,3 @@ function uc_wishlist_schema() {
 
   return $schema;
 }
-
-/**
- * Replaced the anonymous configuration settings with 'create wish lists'
- * permissions.
- */
-function uc_wishlist_update_7001() {
-  $allow_anonymous = \Drupal::config()->get('uc_wishlist_allow_anonymous', FALSE);
-  if ($allow_anonymous) {
-    user_role_change_permissions(DRUPAL_ANONYMOUS_RID, ['create wish lists' => TRUE]);
-  }
-  variable_del('uc_wishlist_allow_anonymous');
-}
diff --git a/uc_wishlist.links.menu.yml b/uc_wishlist.links.menu.yml
index 7ad561f..4ac7160 100644
--- a/uc_wishlist.links.menu.yml
+++ b/uc_wishlist.links.menu.yml
@@ -1,4 +1,4 @@
-uc_wishlist.settings:
+  uc_wishlist.settings:
   title: 'Wish list settings'
   route_name: uc_wishlist.config
   description: 'Configure the wish list settings.'
@@ -19,4 +19,9 @@ uc_wishlist.wishlist.search:
   title: 'Find a wish list'
   route_name: uc_wishlist.wishlist.search
   description: 'Search wish list'
-  parent: uc_wishlist.wishlist
+
+uc_wishlist.user_settings:
+  title: 'User wish list settings'
+  route_name: uc_wishlist.user_settings
+  description: 'Configure user wish list settings'
+  parent: uc_wishlist.admin.store.customers
diff --git a/uc_wishlist.links.tasks.yml b/uc_wishlist.links.tasks.yml
index f821ab9..54c664b 100644
--- a/uc_wishlist.links.tasks.yml
+++ b/uc_wishlist.links.tasks.yml
@@ -1,5 +1,8 @@
-uc_wishlist.tab_1:
+uc_wishlist.user_settings:
+  route_name: uc_wishlist.user_settings:
+  title: 'User wish list settings'
+
+uc_wishlist.email:
   route_name: uc_wishlist.wishlist.email_form
-  title: Email
-  base_route: uc_wishlist.wishlist.email_form
-  weight:
+  title: 'Wishlist-Email'
+  base_route: uc_wishlist.wishlist
diff --git a/uc_wishlist.module b/uc_wishlist.module
index cd1eed0..6e2d789 100644
--- a/uc_wishlist.module
+++ b/uc_wishlist.module
@@ -1,14 +1,14 @@
 <?php
+
 /**
  * @file
  * Allows users to create public shopping/wish lists.
  */
 
-use Drupal\Component\Utility\Xss;
 use Drupal\Core\Url;
 use Drupal\node\Entity\Node;
-use Drupal\uc_wishlist\Database\DBQuery;
 use Drupal\Core\Form\FormState;
+use Drupal\uc_order\Entity\Order;
 
 /**
  * Implements hook_theme().
@@ -17,12 +17,12 @@ function uc_wishlist_theme() {
   return [
     'uc_wishlist_view_wishlist' => [
       'variables' => [
-        'form' => null,
+        'form' => NULL,
         'expired' => FALSE,
-        'expiration_date' => null,
-        'message' => null,
-        'wishlist' => null,
-        'email_link' => null,
+        'expiration_date' => NULL,
+        'message' => NULL,
+        'wishlist' => NULL,
+        'email_link' => NULL,
       ],
     ],
     'uc_wishlist_block_title' => [
@@ -62,7 +62,8 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
       return;
     }
     $moduleHandler = \Drupal::service('module_handler');
-    $product = $form_state->getBuildInfo();//['args'][0];
+    // ['args'][0];.
+    $product = $form_state->getBuildInfo();
     // Check only stock active products, and if not, bail out.
     $config = \Drupal::config('uc_wishlist.settings');
     if (!$config->get('uc_wishlist_out_of_stock')) {
@@ -75,11 +76,11 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
     }
 
     $pid = $form['nid']['#value'];
-    $database = new DBQuery(\Drupal::database());
+    $wishlist_manager = \Drupal::service('uc_wishlist.manager');
     $wid = uc_wishlist_get_wid();
-    //check to see if the users wishlist has been created
-    if($wid == null || empty($wid)) {
-    // Add the wish list button to the add to cart form because this users wishlist hasnt been made yet
+    // Check to see if the users wishlist has been created.
+    if ($wid == NULL || empty($wid)) {
+      // Add the wish list button to the add to cart form because this users wishlist hasnt been made yet.
       $form['actions']['wishlist'] = [
         '#type' => 'submit',
         '#attributes' => ['class' => ['node-add-to-wishlist']],
@@ -89,11 +90,11 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
       ];
     }
     else {
-      //make sure this product isnt already in the users wish list
-      $wishlistProduct = $database->isProductInWishlist($wid,$pid);
+      // Make sure this product isnt already in the users wish list.
+      $wishlistProduct = $wishlist_manager->isProductInWishlist($wid, $pid);
       if (is_object($wishlistProduct[0])) {
-      //dpm($wishlistProduct[0]);
-      //the product was found in the user's wishlist so display the remove from wishlist button on the add to cart form
+        // dpm($wishlistProduct[0]);
+        // the product was found in the user's wishlist so display the remove from wishlist button on the add to cart form.
         $form['actions']['wishlist'] = [
           '#type' => 'submit',
           '#attributes' => ['class' => ['node-add-to-wishlist']],
@@ -103,13 +104,13 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
         ];
       }
       else {
-        //product is not in the users wishlist
+        // Product is not in the users wishlist.
         $form['actions']['wishlist'] = [
-           '#type' => 'submit',
-           '#attributes' => ['class' => ['node-add-to-wishlist']],
-           '#value' => t('Add to wish list'),
-           '#submit' => ['uc_wishlist_add_to_wishlist_submit'],
-           '#weight' => 1,
+          '#type' => 'submit',
+          '#attributes' => ['class' => ['node-add-to-wishlist']],
+          '#value' => t('Add to wish list'),
+          '#submit' => ['uc_wishlist_add_to_wishlist_submit'],
+          '#weight' => 1,
         ];
       }
     }
@@ -118,8 +119,8 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
   // Checking if the product is added from wishlist in checkout page.
   if ($form_id == 'uc_cart_checkout_form') {
     if (isset($form['panes']['cart']['cart_review_table']['#items']) && !empty($form['panes']['cart']['cart_review_table']['#items'])) {
-            $items = $form['panes']['cart']['cart_review_table']['#items'];
-            $wids = array();
+      $items = $form['panes']['cart']['cart_review_table']['#items'];
+      $wids = [];
 
       foreach ($items as $item) {
         if (!empty($item->data['wid'])) {
@@ -139,7 +140,7 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
         !empty($wishlist->address->addr1) && !empty($wishlist->address->postcode) &&
         is_object($form['panes']['delivery']['address']['#default_value']) &&
         empty($form['panes']['delivery']['address']['#default_value']->delivery_first_name)) {
-          $order = uc_order_load($_SESSION['cart_order']);
+          $order = Order::load($_SESSION['cart_order']);
           if ($order) {
             $defaults = $order;
             $defaults->delivery_first_name = $wishlist->address->firstname;
@@ -162,15 +163,19 @@ function uc_wishlist_form_alter(&$form, FormState $form_state, $form_id) {
   }
 }
 
-function uc_wishlist_remove_from_wishlist_submit($form, FormState $form_state)
-{
-  $database = new DBQuery(\Drupal::database());
+/**
+ *
+ */
+function uc_wishlist_remove_from_wishlist_submit($form, FormState $form_state) {
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
   $pid = $form_state->getValue('nid');
-  $database->remove_product($pid);
+  $wishlist_manager->remove_product($pid);
   $node = Node::load($pid);
   $productTitle = $node->get('title')->getValue()[0]['value'];
-  drupal_set_message(t('<b>@product_title</b> was removed from <a href="@url">your wish list</a>.',['@product_title'=>$productTitle,'@url'=>\Drupal\Core\Url::fromRoute('uc_wishlist.wishlist')->toString()]));
+  drupal_set_message(t('@product_title was removed from your wish list.',
+    ['@product_title' => $productTitle, '@url' => Url::fromRoute('uc_wishlist.wishlist')->toString()]));
 }
+
 /**
  * Submit handler of the uc_wishlist_add_to_wishlist.
  *
@@ -193,16 +198,16 @@ function uc_wishlist_create_wishlist($title = NULL) {
   // Abort if user is not logged in and anonymous wish lists are not allowed.
   if (!$user->id() && !$user->hasPermission('create wish lists')) {
     drupal_set_message(t('You must be logged in to create a wish list. Please <a href="@login_url">login</a> or <a href="@register_url">register</a>.',
-        array(
-         '@login_url' => Drupal\Core\Url::fromRoute('user.login'),
-         '@register_url' => Drupal\Core\Url::fromRoute('user.register')
-        )));
+        [
+          '@login_url' => Url::fromRoute('user.login'),
+          '@register_url' => Url::fromRoute('user.register'),
+        ]));
     return FALSE;
   }
 
   // Get the current user ID for the wish list.
   $uid = uc_wishlist_get_uid();
-  $config = \Drupal::config('uc_wishlist');
+  $config = \Drupal::config('uc_wishlist.settings');
   if (empty($title)) {
     $title = $config->get('uc_wishlist_default_title');
   }
@@ -215,21 +220,21 @@ function uc_wishlist_create_wishlist($title = NULL) {
   $expiration = REQUEST_TIME + $config->get('uc_wishlist_default_length');
 
   $private = $config->get('uc_wishlist_default_private') ? $config->get('uc_wishlist_default_private') : 0;
-  $db = new DBQuery(\Drupal::database());
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
   $fields = [
     'uid',
     'title',
     'expiration',
-    'private'
+    'private',
   ];
   $values = [
     $uid,
     $title,
     $expiration,
-    $private
+    $private,
   ];
-  $db = new DBQuery(\Drupal::database());
-  $result = $id = $db->createWishlist($fields,$values);
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
+  $result = $id = $wishlist_manager->createWishlist($fields, $values);
 
   if ($result) {
     return $id;
@@ -249,7 +254,7 @@ function uc_wishlist_add_item($nid, $qty = 1, $data = NULL, $wid = NULL, $msg =
     $wid = uc_wishlist_create_wishlist();
 
     if (!$wid) {
-      drupal_set_message($this->t('Could not create wish list. Adding item failed.'), 'error');
+      drupal_set_message(t('Could not create wish list. Adding item failed.'), 'error');
       return FALSE;
     }
     $created = TRUE;
@@ -264,74 +269,73 @@ function uc_wishlist_add_item($nid, $qty = 1, $data = NULL, $wid = NULL, $msg =
   elseif (!array_key_exists('module', $data)) {
     $data['module'] = 'uc_product';
   }
-  //$data = $node;
+  // $data = $node;
   // If Product Kit is enable, then add products into data array.
   $moduleHandler = \Drupal::service('module_handler');
-    /*
-    if ($moduleHandler->moduleExists('uc_product_kit') && $node->getType() == 'product_kit') {
+  /*
+  if ($moduleHandler->moduleExists('uc_product_kit') && $node->getType() == 'product_kit') {
 
-        // Adding products of the product kit into data object.
-        $products = $node->products;
+  // Adding products of the product kit into data object.
+  $products = $node->products;
 
-        foreach ($products as $pid => $product) {
+  foreach ($products as $pid => $product) {
 
-            $data['products'][$pid]['nid'] = $pid;
-            $data['products'][$pid]['qty'] = $product->qty;
+  $data['products'][$pid]['nid'] = $pid;
+  $data['products'][$pid]['qty'] = $product->qty;
 
-            // Creating attributes array.
-            $attributes = array();
+  // Creating attributes array.
+  $attributes = array();
 
-            // Getting attributes list of the product.
-            $product_attributes = $product->attributes;
+  // Getting attributes list of the product.
+  $product_attributes = $product->attributes;
 
-            // Iterating through the attributes list.
-            foreach ($product_attributes as $aid => $product_attribute) {
-                $attribute[$product_attribute->aid] = $product_attribute->default_option;
-            }
+  // Iterating through the attributes list.
+  foreach ($product_attributes as $aid => $product_attribute) {
+  $attribute[$product_attribute->aid] = $product_attribute->default_option;
+  }
 
-            // Assigning attributes to data array.
-            $data['products'][$pid]['attributes'] = $attributes;
-        }
-    }
-    */
-    // If product kit module is install in the site, then we need to check if the
-    // product is product kit or product.
-    /*
-    if ($moduleHandler->moduleExists('uc_product_kit')) {
-        $supported_node_types = array_merge(array_keys(uc_product_node_info()), array_keys(uc_product_kit_node_info()));
-    }
-    else {
-        $supported_node_types = array_keys(uc_product_node_info());
-    }
+  // Assigning attributes to data array.
+  $data['products'][$pid]['attributes'] = $attributes;
+  }
+  }
+   */
+  // If product kit module is install in the site, then we need to check if the
+  // product is product kit or product.
+  /*
+  if ($moduleHandler->moduleExists('uc_product_kit')) {
+  $supported_node_types = array_merge(array_keys(uc_product_node_info()), array_keys(uc_product_kit_node_info()));
+  }
+  else {
+  $supported_node_types = array_keys(uc_product_node_info());
+  }
 
-    // Checking if the node is product type or product kit type.
+  // Checking if the node is product type or product kit type.
 
-    if (!in_array($node->type, $supported_node_types)) {
-        drupal_set_message(t('@title is not a product. Unable to add to wish list.', array('@title' => $node->title)), 'error');
-        return;
-    }
+  if (!in_array($node->type, $supported_node_types)) {
+  drupal_set_message(t('@title is not a product. Unable to add to wish list.', array('@title' => $node->title)), 'error');
+  return;
+  }
 
-    $result = $moduleHandler->invokeAll('add_to_cart', $nid, $qty, $data);
-    if (is_array($result) && !empty($result)) {
-        foreach ($result as $row) {
-            if ($row['success'] === FALSE) {
-                if (isset($row['message']) && !empty($row['message'])) {
-                    $message = $row['message'];
-                }
-                else {
-                    $message = t('Sorry, that item is not available for purchase at this time.');
-                }
-                drupal_set_message(\Drupal\Component\Utility\Xss::filter($message), 'error');
-                return;
-            }
-        }
-    }
-    */
-  $db = new DBQuery(\Drupal::database());
-    //$result = db_query("SELECT * FROM {uc_wishlist_products} WHERE wid = :wid AND nid = :nid AND data = :data", array(':wid' => $wid, ':nid' => $nid, ':data' => serialize($data)));
-  $item = $db->getWishlistItem($wid,$nid,$data);//$result->fetchObject();
+  $result = $moduleHandler->invokeAll('add_to_cart', $nid, $qty, $data);
+  if (is_array($result) && !empty($result)) {
+  foreach ($result as $row) {
+  if ($row['success'] === FALSE) {
+  if (isset($row['message']) && !empty($row['message'])) {
+  $message = $row['message'];
+  }
+  else {
+  $message = t('Sorry, that item is not available for purchase at this time.');
+  }
+  drupal_set_message(\Drupal\Component\Utility\Xss::filter($message), 'error');
+  return;
+  }
+  }
+  }
+   */
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
+  $item = $wishlist_manager->getWishlistItem($wid, $nid, $data);
 
-    // If the item isn't in the cart yet, add it.
+  // If the item isn't in the cart yet, add it.
   if (is_null($item) || $item === FALSE) {
     $fields = [
       'wid',
@@ -339,7 +343,7 @@ function uc_wishlist_add_item($nid, $qty = 1, $data = NULL, $wid = NULL, $msg =
       'qty',
       'changed',
       'data',
-      'purchase'
+      'purchase',
     ];
     $values = [
       $wid,
@@ -347,14 +351,14 @@ function uc_wishlist_add_item($nid, $qty = 1, $data = NULL, $wid = NULL, $msg =
       $qty,
       REQUEST_TIME,
       serialize($data),
-      ''
+      '',
     ];
 
-    $id = $db->createWishlistProduct($fields,$values);
+    $id = $wishlist_manager->createWishlistProduct($fields, $values);
     $productTitle = $node->get('title')->getValue()[0]['value'];
-    //dpm($productTitle);
+    // dpm($productTitle);
     if ($msg) {
-      drupal_set_message(t('<b>@product-title</b> was added to <a href="@url">your wish list</a>.', array('@product-title' => $productTitle, '@url' => Url::fromRoute('uc_wishlist.wishlist')->toString())));
+      drupal_set_message(t('<b>@product-title</b> was added to <a href="@url">your wish list</a>.', ['@product-title' => $productTitle, '@url' => Url::fromRoute('uc_wishlist.wishlist')->toString()]));
     }
   }
   else {
@@ -371,12 +375,10 @@ function uc_wishlist_add_item($nid, $qty = 1, $data = NULL, $wid = NULL, $msg =
 
 }
 
-
-
 /**
  * Update information about a specific item in current wish list.
  */
-function uc_product_update_wishlist_item($nid, $data = array(), $qty, $wid = NULL, $wpid = NULL) {
+function uc_product_update_wishlist_item($nid, $data = [], $qty, $wid = NULL, $wpid = NULL) {
   if (!$nid) {
     return NULL;
   }
@@ -385,16 +387,15 @@ function uc_product_update_wishlist_item($nid, $data = array(), $qty, $wid = NUL
 
   if ($qty < 1) {
     $wpid = $wpid ? $wpid : $data['wpid'];
-    uc_wishlist_remove_item($wpid);
   }
   else {
     db_update('uc_wishlist_products')
-        ->fields([
-            'qty' => $qty,
-            'changed' => REQUEST_TIME,
-        ])
-        ->condition('wpid', $wpid)
-        ->execute();
+      ->fields([
+        'qty' => $qty,
+        'changed' => REQUEST_TIME,
+      ])
+      ->condition('wpid', $wpid)
+      ->execute();
   }
 
   if (strpos(\Drupal::request()->getRequestUri(), 'wishlist', 1) !== FALSE) {
@@ -402,26 +403,27 @@ function uc_product_update_wishlist_item($nid, $data = array(), $qty, $wid = NUL
   }
 }
 
-//submit callback handler for wishlistviewform add to cart action
-function addToCart(array &$form, FormState $form_state)
-{
-  //$form_state->get();
+/**
+ * Submit callback handler for wishlistviewform add to cart action.
+ */
+function addToCart(array &$form, FormState $form_state) {
+  // $form_state->get();
   $submitButton = $form_state->getTriggeringElement()['#name'];
   $buttonName = $submitButton;
-  //the add to cart button was pressed on a product in the wish list
-  //explode the button name to get the product id
-  $names = explode('-',$buttonName);
+  // The add to cart button was pressed on a product in the wish list
+  // explode the button name to get the product id.
+  $names = explode('-', $buttonName);
   $pid = $names[1];
 
   $values = $form_state->getValues();
   $nid = $values['items'][$pid]['nid'];
   $qty = $values['items'][$pid]['qty'];
   $data = [
-    'nid'=>$nid,
-    'qty'=>$qty
+    'nid' => $nid,
+    'qty' => $qty,
   ];
   $data = \Drupal::moduleHandler()->invokeAll('uc_add_to_cart_data', [$data]);
-  $msg = true;
+  $msg = TRUE;
   $cart = \Drupal::service('uc_cart.manager')->get();
   $redirect = $cart->addItem($nid, $qty, $data, $msg);
   $form_state->set('variant', uc_product_load_variant($qty, $data));
@@ -437,10 +439,11 @@ function uc_wishlist_get_wid($uid = NULL) {
   // Find the wish list matching the authenticated or anonymous user ID.
   // TODO: Handle multiple wishlists?
   if (empty($uid)) {
-    $uid = \Drupal::currentUser()->id();//uc_wishlist_get_uid();
+    // uc_wishlist_get_uid();
+    $uid = \Drupal::currentUser()->id();
   }
-  $db = new DBQuery(\Drupal::database());
-  return $db->getWishlistIdByUser($uid);//db_query("SELECT wid FROM {uc_wishlists} WHERE uid = :uid", array(':uid' => $uid))->fetchField();
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
+  return $wishlist_manager->getWishlistIdByUser($uid);
 }
 
 /**
@@ -481,8 +484,8 @@ function uc_wishlist_load($wid) {
   if (!$wid || !is_numeric($wid)) {
     return FALSE;
   }
-  $dbQuery = new DBQuery(\Drupal::database());
-  $result = $dbQuery->getWishlist($wid);//db_query("SELECT * FROM {uc_wishlists} WHERE wid = :wid", array(':wid' => $wid));
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
+  $result = $wishlist_manager->getWishlist($wid);
 
   if ($wishlist = $result->fetchObject()) {
     $wishlist->address = unserialize($wishlist->address);
@@ -497,22 +500,21 @@ function uc_wishlist_load($wid) {
 function uc_wishlist_get_contents($wid = NULL) {
   $wid = $wid ? $wid : uc_wishlist_get_wid();
   if (!$wid || !is_numeric($wid)) {
-        return FALSE;
+    return FALSE;
   }
   $items = [];
-  $database = new DBQuery(\Drupal::database());
-  $res = $database->selectWishlistProducts($wid);
-  //dpm($res);
+  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
+  $res = $wishlist_manager->selectWishlistProducts($wid);
+  // dpm($res);
   // Iterating through the array.
   foreach ($res as $item) {
 
-
     $product = Node::load($item->nid);
     $item->model = $product->get('model')->getValue();
     $item->price = $product->get('price')->getValue();
-    //$item->price = $product->get('sell_price');
+    // $item->price = $product->get('sell_price');.
     $item->weight = $product->get('weight')->getValue();
-    //$item->weight_units = $product->get('weight_units');
+    // $item->weight_units = $product->get('weight_units');.
     $item->shippable = $product->get('shippable')->getValue();
     $item->data = unserialize($item->data);
     $item->module = $item->data['module'];
@@ -529,12 +531,3 @@ function uc_wishlist_get_contents($wid = NULL) {
 
   return $items;
 }
-
-/**
- * Implements hook_views_api().
- */
-function uc_wishlist_views_api() {
-  return [
-    'api' => 3,
-  ];
-}
diff --git a/uc_wishlist.permissions.yml b/uc_wishlist.permissions.yml
index db06aef..5a1bb9a 100644
--- a/uc_wishlist.permissions.yml
+++ b/uc_wishlist.permissions.yml
@@ -1,12 +1,12 @@
 administer wish lists:
   title: 'Administer wish lists'
-  description: 'Allows editing or deletion of any wish list.'
+  description: 'Provides permission to configure and administer specific wish list settings.'
 create wish lists:
   title: 'Create wish lists'
-  description: 'Allow creation and editing of own wish list.'
+  description: 'Allows the creation and editing of a personal wish list.'
 access wish lists:
   title: 'Access wish lists'
-  description: 'Allow viewing of any wish list.'
+  description: 'Allows the viewing of any wish list.'
 email wish lists:
-  title: 'Email Own wish list'
-  description: 'Allow Email Own wish list.'
+  title: 'Email own wish list'
+  description: 'Allows the provision of mailing a pesonal wish list.'
diff --git a/uc_wishlist.routing.yml b/uc_wishlist.routing.yml
index 9709102..f174daf 100644
--- a/uc_wishlist.routing.yml
+++ b/uc_wishlist.routing.yml
@@ -4,7 +4,7 @@ uc_wishlist.settings:
     _form: '\Drupal\uc_wishlist\Form\UcWishlistConfigForm'
     _title: 'Wish list settings'
   requirements:
-    _permission: 'Administer wish list settings.'
+    _permission: 'administer wish lists'
   options:
     _admin_route: TRUE
 
@@ -14,7 +14,7 @@ uc_wishlist.admin_wishlist:
     _title: 'Wish lists'
     _controller: '\Drupal\uc_wishlist\Controller\UCWishlistController::AdminWishlist'
   requirements:
-    _permission: 'Manage user wish lists. '
+    _permission: 'administer wish lists'
 
 uc_wishlist.admin_delete:
   path: '/admin/store/customers/wishlist/{uc_wishlist}/delete'
@@ -22,7 +22,7 @@ uc_wishlist.admin_delete:
     _title: 'Delete a wish list'
     _form: '\Drupal\uc_wishlist\Form\UCWishlistAdminDeleteForm'
   requirements:
-    _permission: 'administer wish lists.'
+    _permission: 'administer wish lists'
   options:
     _admin_route: TRUE
 
@@ -32,7 +32,7 @@ uc_wishlist.wishlist:
     _title: 'My Wish list'
     _controller: '\Drupal\uc_wishlist\Controller\UCWishlistController::myWishlist'
   requirements:
-    _permission: 'Create wish lists.'
+    _permission: 'create wish lists'
 
 uc_wishlist.wishlist_view:
   path: '/wishlist/{wid}'
@@ -40,7 +40,7 @@ uc_wishlist.wishlist_view:
     _controller: '\Drupal\uc_wishlist\Controller\UCWishlistController::viewWishlist'
     _title: 'View or modify the contents of your wish list.'
   requirements:
-    _permission: 'access wish lists.'
+    _permission: 'access wish lists'
 
 entity.uc_wishlist.canonical:
   path: '/wishlist/{wid}'
@@ -65,12 +65,31 @@ uc_wishlist.wishlist.search:
     _form: '\Drupal\uc_wishlist\Form\WishlistSearchForm'
     _title: 'Find a wish list'
   requirements:
-    _permission: 'access content'
+    _permission: 'access wish lists'
+
+uc_wishlist.wishlist.search_view:
+  path: '/wishlist/search/{wid}'
+  defaults:
+    _form: '\Drupal\uc_wishlist\Form\WishlistSearchForm'
+    _title: 'Find a wish list'
+  requirements:
+    _permission: 'access wish lists'
+
 
 uc_wishlist.wishlist.email_form:
   path: '/wishlist-email'
   defaults:
-    _title: 'Wishlist email'
+    _title: 'Email Wishlist'
     _form: '\Drupal\uc_wishlist\Form\WishlistEmailForm'
   requirements:
-    _permission: 'access content'
+    _permission: 'access wish lists'
+
+uc_wishlist.user_settings:
+  path: '/admin/store/config/user-settings'
+  defaults:
+    _form: '\Drupal\uc_wishlist\Form\UserWishlistSettingsForm'
+    _title: 'User wish list settings'
+  requirements:
+    _permission: 'administer wish lists'
+  options:
+    _admin_route: TRUE
diff --git a/uc_wishlist.rules.inc b/uc_wishlist.rules.inc
index 5058945..11b571e 100644
--- a/uc_wishlist.rules.inc
+++ b/uc_wishlist.rules.inc
@@ -1,7 +1,12 @@
 <?php
+
 /**
  * @file
- * This file contains the rule condition for the wishlist
+ * This file contains the rule condition for the wishlist.
+ */
+
+/**
+ *
  */
 function uc_wishlist_rules_condition_info() {
   $conditions['uc_wishlist_condition_product_wishlist'] = [
@@ -17,9 +22,3 @@ function uc_wishlist_rules_condition_info() {
   ];
   return $conditions;
 }
-/**
- * Checks if order has wishlist product.
- */
-function uc_wishlist_condition_product_wishlist($order, $settings) {
-  return uc_wishlist_order_wishlist($order);
-}
diff --git a/uc_wishlist.services.yml b/uc_wishlist.services.yml
new file mode 100644
index 0000000..d50c391
--- /dev/null
+++ b/uc_wishlist.services.yml
@@ -0,0 +1,4 @@
+services:
+  uc_wishlist.manager:
+    class: Drupal\uc_wishlist\Database\UcWishlistManager
+    arguments: ['@database']
diff --git a/uc_wishlist.views.inc b/uc_wishlist.views.inc
index ccc8909..23d09fd 100644
--- a/uc_wishlist.views.inc
+++ b/uc_wishlist.views.inc
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * contains the views integration for wishlists.
+ * Contains the views integration for wishlists.
  */
 
 /**
