Fixed setting, made code more elegant

The safe setters were always setting the whole document instead of the
specific path.  In the course of fixing it, I realized I could make the
whole thing much more elegant.  So I did.