Document Versioning

Okie dokie - one giant pull request for #224!! All facets of 'document versioning' have been implemented. I'm sure I'll find some ways to clean this up over the next couple of weeks, but at the moment everything is in a pretty good state.