Code reworking to analize ESD and AOD (H.Qvigstad)