First cut of final code for #81

This is a checkpoint. I still have to resolve an issue of certificates
on the server.