Added test and improved schedules controller