nit: Looks like the same code is also on like 599. Can we lift this out of the conditional, so we always do it first?