 (defn- add-missing-td-elements-replacing-lesson
   "Adds <td> elements that were removed by the `add-module-lesson!` function
    to make way for the lesson."
-  [$parentTd ttLessonInfo]
-  (let [startTime (:startTime ttLessonInfo)
-        endTime   (:endTime ttLessonInfo)]
-    (loop [$currentTd $parentTd
-           timeIdx    (inc startTime)]
-      (if (>= timeIdx endTime)
-          nil
-          (let [[hourClass minuteClass]
-                (get-css-hour-minute-classes-for-time timeIdx)
-
-                $newTdElem
-                ($ "<td />" (js-obj "class" (str hourClass " " minuteClass)))]
-            ; Insert after new <td> after the current <td>
-            (insert-after $newTdElem $currentTd)
-            ; Then use the new <td> as the current <td> in the next iteration
-            (recur $newTdElem (inc timeIdx)))))))
+  [$parentTd startTime endTime]
+  (loop [$currentTd $parentTd
+         timeIdx    (inc startTime)]
+    (if (>= timeIdx endTime)
+        nil
+        (let [[hourClass minuteClass]
+              (get-css-hour-minute-classes-for-time timeIdx)
+
+              $newTdElem
+              ($ "<td />" (js-obj "class" (str hourClass " " minuteClass)))]
+          ; Insert after new <td> after the current <td>
+          (insert-after $newTdElem $currentTd)
+          ; Then use the new <td> as the current <td> in the next iteration
+          (recur $newTdElem (inc timeIdx))))))
 
 (defn- remove-lesson-group-html
   "Removes a lesson group for a module from the HTML timetable.

                 ttLessonInfo {:moduleCode moduleCode, :lessonType lessonType,
                               :lessonGroup lessonGroup, :startTime startTime,
                               :endTime endTime}
                 $lessonDiv   (get ttRow ttLessonInfo)
                 $parentTd    (parent $lessonDiv)]
             ; Remove the `colspan` attribute of the parent <td> so it has
             ; colspan=1
             (remove-attr $parentTd "colspan")
             ; Remove the HTML div elem
             (.remove $lessonDiv)
             ; Add the missing <td> elements
             (add-missing-td-elements-replacing-lesson $parentTd ttLessonInfo)
             (assoc ttLessonInfo :day day, :rowNum rowNum)))
         lessonInfoSeq)))


    ; restore the colspan of the source <td>
    (remove-attr $sourceTd "colspan")
    ; fill in removed <td> for the source <td>
    (add-missing-td-elements-replacing-lesson $sourceTd startTime endTime)
    ; remove sibling <td> for the destination <td> to make way for columns
    ; occupied by $divElem
    (doseq [$siblingTd (take (dec slotsOccupied) (.nextAll $destTd))]
