Add document and folder counts and make tests a little more stable.
Begin cleaning up folder api.