diff --git a/src/Form/XmlSitemapDeleteForm.php b/src/Form/XmlSitemapDeleteForm.php
index 0afd6ad..14bf422 100644
--- a/src/Form/XmlSitemapDeleteForm.php
+++ b/src/Form/XmlSitemapDeleteForm.php
@@ -47,7 +47,7 @@ class XmlSitemapDeleteForm extends EntityConfirmFormBase {
   /**
    * {@inheritdoc}
    */
-  public function submit(array $form, FormStateInterface $form_state) {
+  public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->entity->delete();
     drupal_set_message($this->t('Sitemap %label has been deleted.', array('%label' => $this->entity->label())));
     $form_state->setRedirect('xmlsitemap.admin_search');
diff --git a/src/Form/XmlSitemapEntitiesSettingsForm.php b/src/Form/XmlSitemapEntitiesSettingsForm.php
index ced17a0..c6ca518 100644
--- a/src/Form/XmlSitemapEntitiesSettingsForm.php
+++ b/src/Form/XmlSitemapEntitiesSettingsForm.php
@@ -144,17 +144,18 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
             '#markup' => SafeMarkup::checkPlain($bundle_info['label']),
           ),
           'operations' => [
-          '#type' => 'operations',
-          '#links' => [
-          'configure' => [
-          'title' => $this->t('Configure'),
-          'url' => Url::fromRoute('xmlsitemap.admin_settings_bundle', array(
-                  'entity' => $entity_type_id,
-                  'bundle' => $bundle,
-                  'query' => drupal_get_destination(),
-                )),
-          ]
-          ]
+            '#type' => 'operations',
+            '#links' => [
+            'configure' => [
+              'title' => $this->t('Configure'),
+              'url' => Url::fromRoute('xmlsitemap.admin_settings_bundle', [
+                'entity' => $entity_type_id,
+                'bundle' => $bundle,
+              ], [
+                'query' => drupal_get_destination(),
+              ]),
+              ]
+            ]
           ],
         );
         $form['settings'][$entity_type_id]['types']['#default_value'][$bundle] = xmlsitemap_link_bundle_check_enabled($entity_type_id, $bundle);
@@ -199,6 +200,7 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
         }
       }
     }
+    \Drupal::state()->set('xmlsitemap_regenerate_needed', TRUE);
     parent::submitForm($form, $form_state);
   }
 }
diff --git a/src/Form/XmlSitemapLinkBundleSettingsForm.php b/src/Form/XmlSitemapLinkBundleSettingsForm.php
index 7622896..2ca103c 100644
--- a/src/Form/XmlSitemapLinkBundleSettingsForm.php
+++ b/src/Form/XmlSitemapLinkBundleSettingsForm.php
@@ -129,6 +129,7 @@ class XmlSitemapLinkBundleSettingsForm extends ConfigFormBase implements Contain
 
     $xmlsitemap = $form_state->getValue('xmlsitemap');
     xmlsitemap_link_bundle_settings_save($this->entity_type, $this->bundle_type, $xmlsitemap, TRUE);
+    \Drupal::state()->set('xmlsitemap_regenerate_needed', TRUE);
 
     $entity_info = $form['xmlsitemap']['#entity_info'];
     if (!empty($form['xmlsitemap']['#show_message'])) {
diff --git a/src/Form/XmlSitemapSettingsForm.php b/src/Form/XmlSitemapSettingsForm.php
index b35d2b9..a8a9ab1 100644
--- a/src/Form/XmlSitemapSettingsForm.php
+++ b/src/Form/XmlSitemapSettingsForm.php
@@ -252,7 +252,7 @@ class XmlSitemapSettingsForm extends ConfigFormBase {
       $config->set('frontpage_priority', $frontpage_priority);
       $config->set('frontpage_changefreq', $frontpage_changefreq);
       $config->save();
-      $this->linkStorage->save(array('type' => 'frontpage', 'id' => 0, 'loc' => '', 'priority' => $frontpage_priority, 'changefreq' => $frontpage_changefreq));
+      $this->linkStorage->save(array('type' => 'frontpage', 'id' => 0, 'loc' => '', 'subtype' => '', 'priority' => $frontpage_priority, 'changefreq' => $frontpage_changefreq));
     }
     $this->state->set('xmlsitemap_developer_mode', $values['xmlsitemap_developer_mode']);
     $this->state->set('xmlsitemap_base_url', $values['xmlsitemap_base_url']);
diff --git a/src/XmlSitemapGenerator.php b/src/XmlSitemapGenerator.php
index 10a741b..9e95379 100644
--- a/src/XmlSitemapGenerator.php
+++ b/src/XmlSitemapGenerator.php
@@ -14,6 +14,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Url;
+use \Psr\Log\LoggerInterface;
 
 /**
  * XmlSitemap generator service class.
@@ -70,6 +71,13 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
   protected $state;
 
   /**
+   * A logger instance.
+   *
+   * @var \Psr\Log\LoggerInterface
+   */
+  protected $logger;
+
+  /**
    * Constructs a XmlSitemapGenerator object.
    *
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
@@ -78,12 +86,15 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
    *   The entity manager handler.
    * @param \Drupal\Core\State\StateInterface $state
    *   The state handler.
+   * @param \Psr\Log\LoggerInterface $logger
+   *   A logger instance.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, StateInterface $state, LanguageManagerInterface $language_manager) {
+  public function __construct(ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, StateInterface $state, LanguageManagerInterface $language_manager, LoggerInterface $logger) {
     $this->config = $config_factory->getEditable('xmlsitemap.settings');
     $this->entityManager = $entity_manager;
     $this->state = $state;
     $this->languageManager = $language_manager;
+    $this->logger = $logger;
   }
 
   /**
@@ -123,7 +134,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
     $this->setMemoryLimit();
 
     if ($this->state->get('xmlsitemap_developer_mode')) {
-      watchdog('xmlsitemap', 'Starting XML sitemap generation. Memory usage: @memory-peak.', array(
+      $this->logger->notice('Starting XML sitemap generation. Memory usage: @memory-peak.', array(
         '@memory-peak' => format_size(memory_get_peak_usage(TRUE)),
           ), WATCHDOG_DEBUG
       );
@@ -188,7 +199,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
       $writer->endDocument();
     }
     catch (Exception $e) {
-      watchdog_exception('xmlsitemap', $e);
+      $this->logger->error($e);
       throw $e;
     }
 
@@ -291,7 +302,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
       $writer->endDocument();
     }
     catch (Exception $e) {
-      watchdog_exception('xmlsitemap', $e);
+      $this->logger->error($e);
       throw $e;
       return FALSE;
     }
@@ -361,11 +372,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
       $this->state->set('xmlsitemap_generated_last', REQUEST_TIME);
       drupal_set_message(t('The sitemaps were regenerated.'));
       // Show a watchdog message that the sitemap was regenerated.
-      watchdog('xmlsitemap', 'Finished XML sitemap generation in @elapsed. Memory usage: @memory-peak.', array(
-        '@elapsed' => $elapsed,
-        '@memory-peak' => format_size(memory_get_peak_usage(TRUE)),
-          ), WATCHDOG_NOTICE
-      );
+      $this->logger->notice('Finished XML sitemap generation in @elapsed. Memory usage: @memory-peak.', ['@elapsed' => $elapsed, '@memory-peak' => format_size(memory_get_peak_usage(TRUE))]);
     }
     else {
       drupal_set_message(t('The sitemaps were not successfully regenerated.'), 'error');
@@ -404,8 +411,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
     }
     $info = $context['sandbox']['info'];
 
-    $query = new EntityFieldQuery();
-    $query->entityCondition('entity_type', $entity);
+    $query = \Drupal::entityQuery($entity);
     $query->entityCondition('entity_id', $context['sandbox']['last_id'], '>');
     $query->addTag('xmlsitemap_link_bundle_access');
     $query->addTag('xmlsitemap_rebuild');
diff --git a/src/XmlSitemapLinkStorage.php b/src/XmlSitemapLinkStorage.php
index 3c6512f..fb88db6 100644
--- a/src/XmlSitemapLinkStorage.php
+++ b/src/XmlSitemapLinkStorage.php
@@ -77,6 +77,10 @@ class XmlSitemapLinkStorage implements XmlSitemapLinkStorageInterface {
       'changefreq' => isset($settings['changefreq']) ? $settings['changefreq'] : 0,
     );
 
+    if (method_exists($entity, 'getChangedTime')) {
+      $entity->xmlsitemap['lastmod'] = $entity->getChangedTime();
+    }
+
     $url = $entity->url();
     // The following values must always be checked because they are volatile.
     $entity->xmlsitemap['loc'] = $uri;
@@ -126,8 +130,8 @@ class XmlSitemapLinkStorage implements XmlSitemapLinkStorageInterface {
       ->fields(array(
         'loc' => $link['loc'],
         'subtype' => $link['subtype'],
-        'access' => $link['access'],
-        'status' => $link['status'],
+        'access' => (int) $link['access'],
+        'status' => (int) $link['status'],
         'status_override' => $link['status_override'],
         'lastmod' => $link['lastmod'],
         'priority' => $link['priority'],
diff --git a/xmlsitemap.module b/xmlsitemap.module
index d57d154..e5347fb 100644
--- a/xmlsitemap.module
+++ b/xmlsitemap.module
@@ -1134,7 +1134,7 @@ function xmlsitemap_add_form_link_options(array &$form, $entity, $bundle, $id) {
   $form['xmlsitemap'] = array(
     '#type' => 'details',
     '#tree' => TRUE,
-    '#title' => t('XML sitemap'),
+    '#title' => \Drupal::translation()->translate('XML sitemap'),
     '#collapsible' => TRUE,
     '#collapsed' => !$link['status_override'] && !$link['priority_override'],
     '#access' => $currentUser->hasPermission('administer xmlsitemap') || xmlsitemap_link_bundle_access($bundle_info),
@@ -1473,19 +1473,6 @@ function xmlsitemap_get_operation_link($url, $options = array()) {
 }
 
 /**
- * Implements hook_entity_info_alter().
- */
-function xmlsitemap_entity_info_alter(&$entity_info) {
-  if (!\Drupal::config('xmlsitemap.settings.user.user')->isNew()) {
-    return $entity_info;
-  }
-  $entity_info['user']['bundle label'] = t('User');
-  $entity_info['user']['xmlsitemap'] = array(
-    'process callback' => 'xmlsitemap_user_xmlsitemap_process_user_links',
-  );
-}
-
-/**
  * Returns HTML for an administration settings table.
  *
  * @param array $variables
@@ -1562,12 +1549,12 @@ function xmlsitemap_xmlsitemap_index_links($limit) {
     }
     try {
       $query = \Drupal::entityManager()->getStorage($entity_type_id)->getQuery();
-      $query->range(0, $limit);
-      if ($entity_type->get('type')) {
-        $query->condition('type', $entity_bundles, 'IN');
-      }
+      $query->condition('type', $entity_bundles, 'IN');
       $ids = $query->execute();
-      xmlsitemap_xmlsitemap_process_entity_links($entity_type_id, $ids);
+      while ($ids) {
+        $ids_part = array_splice($ids, 0, $limit);
+        xmlsitemap_xmlsitemap_process_entity_links($entity_type_id, $ids_part);
+      }
     }
     catch (QueryException $e) {
 
@@ -1769,6 +1756,7 @@ function xmlsitemap_query_xmlsitemap_generate_alter(AlterableInterface $query) {
   $current = $sitemap->context['language'];
   $default = \Drupal::languageManager()->getDefaultLanguage()->getId();
 
+
   if ($mode == 'mixed' && $current == $default) {
     // If mode is mixed but current = default, is the same as 'simple'.
     $mode = 'simple';
@@ -1777,27 +1765,27 @@ function xmlsitemap_query_xmlsitemap_generate_alter(AlterableInterface $query) {
   switch ($mode) {
     case 'simple':
       // Current language and language neutral.
-      $query->condition('language', array($current, LanguageInterface::LANGCODE_NOT_SPECIFIED));
+      $query->condition('language', array($current, LanguageInterface::LANGCODE_NOT_SPECIFIED), 'IN');
       break;
 
     case 'mixed':
       // Mixed current language (if available) or default language (if not) and language neutral.
-      $query->condition('language', array($current, $default, LanguageInterface::LANGCODE_NOT_SPECIFIED));
+      $query->condition('language', array($current, $default, LanguageInterface::LANGCODE_NOT_SPECIFIED), 'IN');
       break;
 
     case 'default':
       // Only default language and language neutral.
-      $query->condition('language', array($default, LanguageInterface::LANGCODE_NOT_SPECIFIED));
+      $query->condition('language', array($default, LanguageInterface::LANGCODE_NOT_SPECIFIED), 'IN');
       break;
 
     case 'strict':
       // Only current language (for nodes), simple for all other types.
       $node_condition = db_and();
-      $node_condition->condition('type', 'node');
-      $node_condition->condition('language', $current);
+      $node_condition->condition('type', 'node', 'IN');
+      $node_condition->condition('language', $current, 'IN');
       $normal_condition = db_and();
       $normal_condition->condition('type', 'node', '<>');
-      $normal_condition->condition('language', array($current, LanguageInterface::LANGCODE_NOT_SPECIFIED));
+      $normal_condition->condition('language', array($current, LanguageInterface::LANGCODE_NOT_SPECIFIED), 'IN');
       $condition = db_or();
       $condition->condition($node_condition);
       $condition->condition($normal_condition);
@@ -2039,7 +2027,7 @@ function xmlsitemap_add_link_bundle_settings(array &$form, FormStateInterface $f
     '#type' => 'select',
     '#title' => t('Inclusion'),
     '#options' => xmlsitemap_get_status_options(),
-    '#default_value' => $bundle_info['status'],
+    '#default_value' => (int) $bundle_info['status'],
   );
   $form['xmlsitemap']['priority'] = array(
     '#type' => 'select',
@@ -2269,11 +2257,11 @@ function _xmlsitemap_get_blurb($check_version = TRUE) {
     $blurb = FALSE;
     if (!$check_version || (($version = _xmlsitemap_get_version()) && preg_match('/dev|unstable|alpha|beta|HEAD/i', $version))) {
       $sponsors = array(
-        $this->l('Symantec', Url::fromUri('http://www.symantec.com/')),
-        $this->l('WebWise Solutions', Url::fromUri('http://www.webwiseone.com/')),
-        $this->l('Volacci', Url::fromUri('http://www.volacci.com/')),
-        $this->l('lanetro', Url::fromUri('http://www.lanetro.com/')),
-        $this->l('Coupons Dealuxe', Url::fromUri('http://couponsdealuxe.com/')),
+        \Drupal::l('Symantec', Url::fromUri('http://www.symantec.com/')),
+        \Drupal::l('WebWise Solutions', Url::fromUri('http://www.webwiseone.com/')),
+        \Drupal::l('Volacci', Url::fromUri('http://www.volacci.com/')),
+        \Drupal::l('lanetro', Url::fromUri('http://www.lanetro.com/')),
+        \Drupal::l('Coupons Dealuxe', Url::fromUri('http://couponsdealuxe.com/')),
       );
       // Don't extract the following string for translation.
       $blurb = '<div class="description"><p>Thank you for helping test the XML sitemap module rewrite. Please consider helping offset developer free time by <a href="http://davereid.chipin.com/">donating</a> or if your company is interested in sponsoring the rewrite or a specific feature, please <a href="http://davereid.net/contact">contact the developer</a>. Thank you to the following current sponsors: ' . implode(', ', $sponsors) . ', and all the individuals that have donated. This message will not be seen in the stable versions.</p></div>';
@@ -2383,7 +2371,6 @@ function xmlsitemap_regenerate_batch(array $smids = array()) {
     'error_message' => $t('An error has occurred.'),
     'finished' => 'xmlsitemap_regenerate_batch_finished',
     'title' => t('Regenerating Sitemap'),
-    'file' => drupal_get_path('module', 'xmlsitemap') . '/xmlsitemap.generate.inc',
   );
 
   // Set the regenerate flag in case something fails during file generation.
@@ -2525,8 +2512,7 @@ function xmlsitemap_rebuild_batch_fetch($entity, &$context) {
   }
   $info = $context['sandbox']['info'];
 
-  $query = new EntityFieldQuery();
-  $query->entityCondition('entity_type', $entity);
+  $query = \Drupal::entityQuery($entity);
   $query->entityCondition('entity_id', $context['sandbox']['last_id'], '>');
   $query->addTag('xmlsitemap_link_bundle_access');
   $query->addTag('xmlsitemap_rebuild');
diff --git a/xmlsitemap.services.yml b/xmlsitemap.services.yml
index 7e503bb..50c8148 100644
--- a/xmlsitemap.services.yml
+++ b/xmlsitemap.services.yml
@@ -1,11 +1,14 @@
 services:
   xmlsitemap_generator:
     class: Drupal\xmlsitemap\XmlSitemapGenerator
-    arguments: ['@config.factory', '@entity.manager', '@state', '@language_manager']
+    arguments: ['@config.factory', '@entity.manager', '@state', '@language_manager', '@xmlsitemap.logger']
     tags:
       - { name: xmlsitemap_generator }
   xmlsitemap.link_storage:
     class: Drupal\xmlsitemap\XmlSitemapLinkStorage
     arguments: ['@state', '@module_handler']
     tags:
-      - { name: xmlsitemap.link_storage }
\ No newline at end of file
+      - { name: xmlsitemap.link_storage }
+  xmlsitemap.logger:
+    parent: logger.channel_base
+    arguments: ['xmlsitemap']
