diff --git a/core/modules/tour/js/tour.js b/core/modules/tour/js/tour.js
index d8885be..df96b80 100644
--- a/core/modules/tour/js/tour.js
+++ b/core/modules/tour/js/tour.js
@@ -3,7 +3,7 @@
  * Attaches behaviors for the Tour module's toolbar tab.
  */
 
-(function ($, Backbone, Drupal, document) {
+(function ($, Backbone, Drupal) {
 
 "use strict";
 
@@ -11,11 +11,12 @@
  * Attaches the tour's toolbar tab behavior.
  */
 Drupal.behaviors.tour = {
-  attach: function (context) {
-    $('body').once('tour', function (index, element) {
+  attach: function () {
+    var $body = $('body').once('tour');
+    if ($body.length) {
       var model = new Drupal.tour.models.StateModel();
       var view = new Drupal.tour.views.ToggleTourView({
-        el: $(context).find('#toolbar-tab-tour'),
+        el: $('#toolbar-tab-tour'),
         model: model
       });
 
@@ -52,17 +53,17 @@ Drupal.behaviors.tour = {
           $(document).trigger((isActive) ? 'drupalTourStarted' : 'drupalTourStopped');
         })
         // Initialization: check whether a tour is available on the current page.
-        .set('tour', $(context).find('ol#tour'));
-    });
+        .set('tour', $('#tour'));
+    }
   }
 };
 
-Drupal.tour = Drupal.tour || { models: {}, views: {}};
+var tour = { models: {}, views: {} };
 
 /**
  * Backbone Model for tours.
  */
-Drupal.tour.models.StateModel = Backbone.Model.extend({
+tour.models.StateModel = Backbone.Model.extend({
   defaults: {
     // Indicates whether the Drupal root window has a tour.
     tour: [],
@@ -80,7 +81,7 @@ Drupal.tour.models.StateModel = Backbone.Model.extend({
 /**
  * Handles edit mode toggle interactions.
  */
-Drupal.tour.views.ToggleTourView = Backbone.View.extend({
+tour.views.ToggleTourView = Backbone.View.extend({
 
   events: { 'click': 'onClick' },
 
@@ -110,13 +111,13 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
    * Model change handler; starts or stops the tour.
    */
   toggleTour: function() {
+    var model = this.model;
+    function postRideCallback () {
+      model.set('isActive', false);
+    }
     if (this.model.get('isActive')) {
       var $tour = this._getTour();
-      this._removeIrrelevantTourItems($tour, this._getDocument());
-      var that = this;
-      $tour.joyride({
-        postRideCallback: function () { that.model.set('isActive', false); }
-      });
+      $tour.joyride({ postRideCallback: postRideCallback });
       this.model.set({ isActive: true, activeTour: $tour });
     }
     else {
@@ -141,64 +142,11 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
    *   A jQuery element pointing to a <ol> containing tour items.
    */
   _getTour: function () {
-    var whichTour = (this.model.get('overlayIsOpen')) ? 'overlayTour' : 'tour';
+    var whichTour = this.model.get('overlayIsOpen') ? 'overlayTour' : 'tour';
     return this.model.get(whichTour);
-  },
-
-  /**
-   * Gets the relevant document as a jQuery element.
-   *
-   * @return jQuery
-   *   A jQuery element pointing to the document within which a tour would be
-   *   started given the current state. I.e. when the Overlay is open, this will
-   *   point to the HTML document inside the Overlay's iframe, otherwise it will
-   *   point to the Drupal root window.
-   */
-  _getDocument: function () {
-    return (this.model.get('overlayIsOpen')) ? $(Drupal.overlay.iframeWindow.document) : $(document);
-  },
-
-  /**
-   * Removes tour items for elements that don't exist.
-   *
-   * @param jQuery $tour
-   *   A jQuery element pointing to a <ol> containing tour items.
-   * @param jQuery $document
-   *   A jQuery element pointing to the document within which the elements
-   *   should be sought.
-   *
-   * @see _getDocument()
-   */
-  _removeIrrelevantTourItems: function ($tour, $document) {
-    var removals = false;
-    $tour
-      .find('li')
-      .each(function () {
-        var $this = $(this);
-        var itemId = $this.attr('data-id');
-        var itemClass = $this.attr('data-class');
-        if ($document.find('#' + itemId + ', .' + itemClass).length === 0) {
-          removals = true;
-          $this.remove();
-        }
-      });
-
-    // If there were removals, we'll have to do some clean-up.
-    if (removals) {
-      var total = $tour.find('li').length;
-      $tour
-        .find('li')
-        // Rebuild the progress data.
-        .each(function (index) {
-          var progress = Drupal.t('!tour_item of !total', { '!tour_item': index + 1, '!total': total });
-          $(this).find('.tour-progress').text(progress);
-        })
-        // Update the last item to have "End tour" as the button.
-        .last()
-        .attr('data-text', Drupal.t('End tour'));
-    }
   }
-
 });
 
-})(jQuery, Backbone, Drupal, document);
\ No newline at end of file
+Drupal.tour = tour;
+
+})(jQuery, Backbone, Drupal);
