Merge development branch into master

This code has been reasonably stable in testing, so merging it into master.