Improve compliance with StyleCop

Added comments via GhostDoc and tidied source so that it passes StyleCop
4.7 validation (with a couple of rules disabled - still much closer to
full compliance).