Erikbern/scheduler refactoring

Lots of minor fixes to scheduling. In particular I've been moving a lot of task and worker specific code onto the Task and Worker classes.

Next step is incremental pruning. I think it's actually very simple by now. That should take a lot of load off the scheduler.