 (declare add-module-lesson-group)
 (declare timetable-prune-empty-rows)
 (declare add-missing-td-elements-replacing-lesson)
+(declare remove-lesson-group-html)
+(declare shift-lessons-upwards-to-replace-empty-slots)
+(declare update-ModulesSelected-for-affected-days)
+
+(def ^{:doc     "Key for a data attribute added to a draggable <div> helper
+                 when the helper has been dropped onto a droppable <div>.
+                 This is used to detect if a lesson group switch has occurred."
+       :private true}
+  LESSON-GROUP-CHANGE-KEY "lessonGroupChangeTo")
 
 (defn- lesson-draggable-start-evt-handler-maker
   "Returns a function that can be used as the `start` event handler for a

    (aset (aget js/document "location") "hash"
          (clojure.string/replace urlHashWithoutModule #"&$" ""))))

(def ^{:doc "Vector of <tBody> objects representing the days of the timetable
             in the Timetable Builder page"
       :private true

                   unselectedLessonGroupsMap)))]
      (set! Lessons-Created-By-Draggable augmentedTTLessonInfoSeq))))

(defn- lesson-draggable-stop-evt-handler-maker
  "Returns a function used as the `stop` event handler for a draggable lesson."
  [moduleCode lessonType lessonGroup bgColorCssClass]
  (fn [evt ui]
    (let [$helper         (aget ui "helper")
          destLessonGroup (data $helper LESSON-GROUP-CHANGE-KEY)

          affectedDaysSet
          (reduce (fn [daySet ttLessonInfo]
                    (conj daySet (:day ttLessonInfo)))
                  #{}
