Various updates, cleanup

Earlier this year I made a few simple cleanups to the code but never bothered to make a pull request. They should merge fine with the google analytics stuff I think.
Nothing to be sorry for! Just thought I'd point out things I noticed. Not sure if you know this--if you push changes to the branch that this PR is based on, the PR will use those latest changes. So if you think any of my comments are change-worthy, you can push them to the branch, and then we can merge.