Production env

Looks like a lot of changes, but is more copy-and-paste than anything else.  Basically, broke code out into managebly-sized functions and added a function to create the production environment.
I thought that @josenavas was repicking against 13_8? We _really_ should not use 4feb2011