Factored gen_schedule into its own file