Make the folds use the doc system too [#8]

Also make improvements to doc system. Mainly squash a performence bug.