Squashed (I think) my previous 13 commits into one for pull request