Updated code for new delay metric