Miscellaneous fixes

A second attempt at submitting some general purpose code cleanup changes. This is a replacement for my prior pull request which was based off 42ae4b5. I tried and failed miserably to rebase that set of changes following your later work. This patch set merges my copy of your master instead which sadly adds an extraneous merge commit in the middle of the stream, but at least looks like it should apply cleanly.

Commits from a87a5e3..fb717e2 are changes that I needed to make to get the demo application running in Labs. I had these in another branch based of my prior changes.

Commits from 764ae18..ec56c26 are additional fixes needed following your refactor to get the demo application back to happy path status.

I'd like to apologize for the messiness of these changes. I started out with good intentions and then went a little crazy beating on things in an attempt to get the demo up.