        {
          :nrLessonGroups (integer representing the number of lesson groups
                           occupying the current row)
-         :occupied       (a vector of timeslots from 0800 to 2330 (inclusive)
-                          in 30 min intervals. Each slot is a boolean value.
-                          A value of `True` indicates that the slot is occupied.
-                          A value of `False` indicates that the slot is free.)
+         :occupied        a vector of timeslots from 0800 to 2330 (inclusive)
+                          in 30 min intervals. Each slot is one of:
+                          - nil. The means that the slot is free
+                          - a map of module information:
+                            {
+                              :moduleCode -> module code string
+                              :lessonType -> lesson type string (long form),
+                              :lessonGroup -> Lesson group string (lesson label)
+                              :index       -> index to the list of lessons for
+                                              that lesson group.
+                            }
+                            This information can be used to access the <div> in
+                            the `ModulesSelected` global during module removal
+                            or lesson shifting.
        }"
   []
   {

            (zero? (:nrLessonGroups row))
            (assoc result :foundFreeRow true)

            (not (some true?
                       (map (fn [timeIdx] (nth (:occupied row) timeIdx))
                            (range startTime endTime))))
            (assoc result :foundFreeRow true)

                                       lessonLabel])]
    (if (and moduleName lessons)
        (let [lessonInfoSeq (doall
                              (map (fn [[lessonIdx lesson]]
                                     (add-module-lesson moduleCode
                                                        moduleName
                                                        lessonType
                                                        lessonLabel
                                                        lesson
                                                        lessonIdx
                                                        bgColorCssClass))
                                   (map vector
                                        (range 0 (count lessons)) lessons)))]
          ; Update ModulesSelected with the lesson group
          (set! ModulesSelected
                (assoc-in ModulesSelected [moduleCode lessonType]
