working except deleting document