Pre-release 4.0

Fixes to a bunch of crap that was a bit messy
Everything else seems to be working quite nicely.

Ready for release