         $thElem        (.find $day "tr > th")
         nrNonEmptyRows (count nonEmptyRows)
 
-        rowsToRemove
-        (cond (>= nrNonEmptyRows 2) emptyRows
-              (=  nrNonEmptyRows 1) (rest emptyRows)
-              :else                 (drop 2 emptyRows))]
+        rowIndicesToPreserve
+        (if (>= nrNonEmptyRows TIMETABLE-MIN-ROWS-FOR-DAY)
+            nonEmptyRows
+            ; Preserve the initial empty rows to make up for the minimum
+            ; number of non-empty rows; remove the remaining empty rows.
+            (concat nonEmptyRows
+                    (take (- TIMETABLE-MIN-ROWS-FOR-DAY nrNonEmptyRows)
+                          emptyRows)))
+
+        orgTotalRows   (+ nrNonEmptyRows (count emptyRows))
+        newNrRows      (max nrNonEmptyRows TIMETABLE-MIN-ROWS-FOR-DAY)
+
+        $rows           (children $day "tr")
+        $rowsToPreserve (map (fn [rowIdx] ($ (nth $rows rowIdx)))
+                             rowIndicesToPreserve)]
+
     ; shift <th> element to the new 0th row
     (if (and (zero? (first emptyRows)) (> nrNonEmptyRows 0))
         (prepend (nth (children $day "tr") (first nonEmptyRows)) $thElem))
 
+    ; Shift the final <tr> to the beginning of the day
+    (doseq [$row (reverse $rowsToPreserve)]
+      (prepend $day $row))
+
     ; remove empty <tr> elements
-    (doseq [[idx rowIdx] (map vector
-                              (range (count rowsToRemove))
-                              rowsToRemove)]
-      (.remove (nth (children $day "tr") (- rowIdx idx))))
-
-    (if (and (= nrNonEmptyRows 1)
-             (zero? (first emptyRows)))
-        (let [$trArray (children $day "tr")]
-          (.log js/console "Am gonna swap this shit man")
-          (.log js/console (str "$trArray = " $trArray ", 0th = " (nth $trArray 0) ", 1st = " (nth $trArray 1)))
-          (before (nth $trArray 0) (nth $trArray 1))))
+    (doseq [rowIdx (reverse (range newNrRows orgTotalRows))]
+      (.remove (nth (children $day "tr") rowIdx)))
 
     ; adjust rowspan of <th>
-    (attr $thElem "rowspan" (max nrNonEmptyRows 2))))
+    (attr $thElem "rowspan" newNrRows)))
 
 (defn- create-lesson-div
   "Creates a <div> element for a new lesson using jQuery"

                     (fn [ttDay]
                       (vec (map (fn [rowIdx]
                                   (timetable-get-day-row ttDay rowIdx))
                                 (cond (>= nrNonEmptyRows 2)
                                       nonEmptyRows

                                       (= nrNonEmptyRows 1)

;                                          sorted lexicographically by
;                                          `:lessonType`
;   }

(def ^{:doc     "Minimum number of rows for a day in the Timetable"
       :private true}
  TIMETABLE-MIN-ROWS-FOR-DAY 2)

(defn- get-ModulesMap
  "Retrieves the `ModulesMap` JavaScript global variable"
