delete document function