Refactor timetable3.py