Achieve 100% doc coverage

This is a finally rebased and tweaked version of #1362, fixes #1362.