Fixed logic for duration.