did some refactoring in schedules controller