Retry middleware updates

Also, pull in my changes in the items_for_0.10_release branch.