many improvements to the code to get it building from a dry run

Benjamin Mako Hill || Want to submit a patch?