Updated with current version of asdoc's timetable algorithm