Cpcode support plus mods

1) With a few more changes on top of your branch, I got cpcodes to work

2) I simplified domain support so that you can specify production or staging.  It was hardcoded to production.

3) With the help of a colleague, we fixed a nagging traceback output that would always occur.