Release 4.0.0

Just a pull to merge in changes made by Gary into this version of branch 4.0.0 so I can create a pull request back into jim618.