Check for null before deleting.  Also zap some unused stuff.