Doc resource refactor

This is required to "rebase" #194.

Please make sure to get #306 in first, so we can see if this passes tests.