updated code to allow application to have many schedules