Release 4.0.0

Pull request to get us nicely in sync again. I have merged all of your changes into my 4.0.0 branch now plus have made a few tweaks for you to pick up.

It looks to be in a good base point now to work from.