I think maybe this entire bit of behavior belongs in its own task/method, and we should figure out how to explode the package, then run this.   Right now, this code is getting to be a bit large to "grok" all at once, and a handy method name can help.  I can do this after merging if you want.