added clear() function, changed run_next_job() to return a job, and also
fixed bugs in priorityscheduler