Added code to calculate ED for 4.f