Add job rescheduler and some refactoring