Further cleanup of documents API.