HLint guided code cleanups

I went to London this weekend. Bored on the train ride back to Paris and with no Internet, I decided to try out HLint on this codebase (never used it before). It works quite nicely. There were automated suggestions for improvement, 23 of which I corrected. The others are either spurious or I don't think contribute to making the code more readable.

While I was at it, I had a read through the code and reindented and reformatted some of the bigger functions, that were running so deep that the left margin was approaching the right edge of my editor in places. Lines are now of much more reasonable length. And then the train arrived at destination.