   [day rowNum]
   (nth (timetable-get-day day) rowNum))
 
-(defn- get-nr-rows-in-timetable-day
-  "Returns the total number of rows in the given 0-indexed day in the Timetable,
-   where 0 = Monday, 1 = Tuesday, until 4 = Friday."
+; Returns the total number of rows for a given day in the Timetable.
+(defmulti get-nr-rows-in-timetable-day number? :default false)
+
+; Argument argument is a a 0-indexed integer representing the day, where
+; 0 = Monday, 1 = Tuesday, until 4 = Friday
+(defmethod get-nr-rows-in-timetable-day true [day]
   [day]
   (count (timetable-get-day day)))
+
+; Argument is a Timetable row returned by the `tiemtable-get-day-row` function
+(defmethod get-nr-rows-in-timetable-day false [ttDay]
+  (count ttDay))
 
 (def ^{:doc     "HTML string for the <td> elements in a <tr> on the Timetable
                  Builder page"

(defn- timetable-row-empty?
  "Returns true if there is no lesson for a given day and row in `Timetable`.
   Returns false otherwise."
  [day rowNum]
  (empty? (timetable-get-day-row day rowNum)))

(defn- timetable-row-not-empty?
  "Returns true if there at least one lesson for a given day and row in
   `Timetable`. Returns false otherwise."
  [day rowNum]
  (not (timetable-row-empty? day rowNum)))

(defn- timetable-row-get-lessons-satisfying-pred
  "Returns a sequence of vectors of `TimetableLessonInfo` object and the

    (filter (fn [[ttLessonInfo _]]
              (predFn ttLessonInfo))
            ttRow)))

(defn- timetable-day-get-empty-and-non-empty-rows
  "Returns a hash like this:
   {
     :emptyRows    -> vector of empty row indices for the day
     :nonEmptyRows -> vector of non empty row indices for the day
   }"
  [day]
  (let [ttDay (timetable-get-day day)]
    (reduce (fn [dayPartition [rowIdx ttRow]]
              (if (timetable-row-empty? ttRow)
                  (update-in dayPartition [:emptyRows] #(conj %1 rowIdx))
                  (update-in dayPartition [:nonEmptyRows] #(conj %1 rowIdx))))
            {:emptyRows [], :nonEmptyRows []}
            (map vector
                 (range (get-nr-rows-in-timetable-day ttDay))
                 ttDay))))

(defn- create-lesson-div
  "Creates a <div> element for a new lesson using jQuery"
