Reimplement according to new specifications.

Unfortunately, not much of the old code could be re-used.

This is the bare-bone prototype.

In particular, there is no disk persistence yet.
And no tests...