This is actually mostly done and tested, I iterated on it for hours before bothering to set up a proper git repo.