Squashed commits into a single commit for easier commenting on Github

Thanks for doing this, looks pretty good but I have a few thoughts and recommendations. See below for comments.

(Note, I squashed all your commits into a single commit, so you probably wouldn't want to merge this to master)