added code to schedule a job and terminate a job