Work in progress: first implementation

This is ostensibly @drj11's work, which I'm going to continue.