- first pass on the code

Trying to abstract this from client work. Not yet tested on a proper
site for deployment configuration.