Probably self-hoist this to the top of the function.