Address PR feedback:

* Add more comments/documentation
* Smarter way of fetching document filter sets
  (use getDocWithIDs instead of getAllDocs)
* Add more tests