v3 to v4

Another complete rebuild of the software