Support for passing a struct to a document instead of map[string]interface{}

I have committed another fix to clean things up even more.