First attempt at document types.

Lets have a chat about this and see if it's how we want to go.  Also, lets try and figure out if this fits with Rick's version and see if we can combine them (or otherwise which one we should use).