Implement find next task to run.