Can we move this common function into a shared file, so that changes don't have to be made across all these duplicate copies?