I might move this line into the `if (duration...)` conditional since it doesn't seem to be used unless that is true.