Support sub-doc updates

I would propose using a type check on ref instead of just a simple true/false. It makes the code more obvious as to what it's looking for.
`if type(ref) == str:`