use when instead of if
expand breaks duration field deeper