Further changes

Broke up task and Placed contextlib decorators on the new functions.
Fixed bugs found on ubuntu precise tests.  Implemented suggestions made
in Dan's first review.

There are now two separate commits for this change.  When it becomes
time to pull these changes into a non-testing branch, I will squash
these commit and repush this.