explain_duration function corrected