First round of changes, attempt 2

Here's the second try, along with Chad's changes to submit as a PR.