functions to generate schecules