Changed buildTimetable function