basic logic for the schedule generator