Synchronise master with @markburgess's recent development work.

This is my current version of Mark's branch, that I hope to be able to merge this afternoon, subject to testing.