We should probably extract this into a shared module at some point, seeing as it'll likely be used elsewhere in the future too.