(v3.0) Overhaul to code and many bug fixes

Finally brought this library up to date.

Editor update will follow but that will take a lot longer as it needs to
be almost fully rewritten.