or maybe just pull this out in a small function, if we're doing this in multiple places?