Add length to Documents.

TODO:

 - [x] figure out why this conflicts with tree lengths