Added real document counter. Fixes #39