A performance tweak and some coding standard changes.

Sorry for lumping these together, future pull requests will be individual commits, as opposed to aesthetic and logical combined.

Details are in each commit message.