Added safe deletion functions