Improve documentation and comments.

Signed-off-by: Peter Hartree <web@peterhartree.co.uk>