Merge pull request #391 from peternewman/trivial-fixes

Tidy up various minor things that appear lots of times throughout the codebase.