Lots and lots of code cleanup based on new Task interface