The function is used in multiple places, so split it out. In particular because I'm about to change it.