Basically re-written from scratch.

Includes publishing API and spiffy new command line client