Added method adddocument to handle a single doc